Commit 4edeccbc authored by tom's avatar tom

fix routed tabs hook

parent 461f8dd8
......@@ -49,10 +49,10 @@ export default function useAdaptiveTabs(tabs: Array<RoutedTab>, disabled?: boole
}, [ tabs, disabled ]);
React.useEffect(() => {
!disabled && setTabsRefs(tabsList.map((_, index) => tabsRefs[index] || React.createRef()));
// imitate componentDidMount
setTabsRefs(disabled ? [] : tabsList.map((_, index) => tabsRefs[index] || React.createRef()));
// update refs only when disabled prop changes
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [ disabled ]);
React.useEffect(() => {
if (tabsRefs.length > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment