Skip to content

Commit edd13c4

Browse files
committed
change how internal tabs state is compared to tabs that came from props
compare reference of prev tabs and tabs that came from props instead of comparing string of conca tinated ids to decide whether internal state should be updated
1 parent 4b7ba0b commit edd13c4

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/lib/tabs-ui/useTabs.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,7 @@ const useTabModels = (apiRef: MutableRefObject<TabsApi>, props: TabsProps) => {
267267

268268
const { tabs: prevTabs } = apiRef.current.getState();
269269

270-
const hashTabs = (tabs: TabModel[]) => {
271-
return tabs.map((tab) => tab.id).join("");
272-
};
273-
274-
if (tabsFromProps && hashTabs(prevTabs) != hashTabs(tabsFromProps)) {
270+
if (tabsFromProps && prevTabs != tabsFromProps) {
275271
apiRef.current.setTabs(tabsFromProps, false);
276272
}
277273
};

0 commit comments

Comments
 (0)