tabs icon indicating copy to clipboard operation
tabs copied to clipboard

Bug: Tabs and Panels aren't working as expected using React.StrictMode

Open alessio-libardi opened this issue 3 years ago • 1 comments

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

alessio-libardi avatar Oct 05 '21 08:10 alessio-libardi

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.

alessio-libardi avatar Oct 05 '21 08:10 alessio-libardi