Skip to content

Commit

Permalink
fix: 修复设置activatedTab逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
pansinm committed Aug 2, 2021
1 parent f6619c8 commit 5d9eab3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export function Tabs({
updateTab(currentTab.id, tab);
}
}
});

(tabs as TabProperties[]).forEach((tab) => {
if (tab.active) {
activeTab(tab.id);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function useChromeTabs(listeners: Listeners) {
const ele = ref.current?.querySelector(
`[data-tab-id="${tabId}"]`
) as HTMLDivElement;
if (ele) {
if (ele !== chromeTabsRef.current?.activeTabEl) {
chromeTabsRef.current?.setCurrentTab(ele);
}
}, []);
Expand Down

0 comments on commit 5d9eab3

Please sign in to comment.