tabs
tabs copied to clipboard
Bug: Tabs and Panels aren't working as expected using React.StrictMode
Using React.StrictMode to wrap our app give inconsistent results in how the Tabs and Panels indexes are generated.
Related issue: Wonderflow Design System #153
The issue is related to the useConstant hook that gets called twice in development. This further causes the tabs and panels count to be duplicated.
Edit: After more investigation of the code the issue seems more related to the way the <Tab>
and <Panel>
count is done. Basically the useTabState
and usePanelState
are counting how many times the <Tab>
and <Panel>
are rendered so that each can get its appropriate state and consequentially be actived. Using <StrictMode>
this is obviously a problem. I'll further investigate on a solution.