Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove inconsistencies when using React.StrictMode #220

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alessio-libardi
Copy link

This PR aims to fix #219.

To do so a change was done in the way <Tab> and <Panel> are counted. Previously <Tab> and <Panel> were counted based on how many times the relative hooks were called, such a usage was a problem when using <React.StrictMode> that duplicates renders during development.

The way we corrected this issue is by caching the children of the <Tab> or <Panel> components in an array, making sure that only unique children get pushed into the cache. With this we only changed the way the index is calculated.

Fixes #219

Alessio Libardi added 3 commits October 5, 2021 10:23
replace tab and panel counting based on render cycles with children as unique keys

Fixes issues jeetiss#219
@alessio-libardi
Copy link
Author

Hello @jeetiss let me know if there's something to improve!

Thanks 🙌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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