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

TabPanel: fix the exhaustive-deps warning #45660

Merged
merged 3 commits into from
Nov 10, 2022
Merged

Conversation

ciampo
Copy link
Contributor

@ciampo ciampo commented Nov 9, 2022

What?

Fix the exhaustive-deps warning in the TabPanel component

Related to:

Why?

Because #41166

How?

  • Add handleTabSelection to the list of useEffect dependencies
  • Wrap handleTabSelection in useCallback

Testing Instructions

  • Check the TabPanel component in both Storybook and the editor
  • In particular, this PR may cause the handleTabSelection to fire more often than before — when smoke testing, pay particular attention to consumers of TabPanel passing the onSelect prop, and how frequently the onSelect callback gets called after the changes from this PR.

@codesandbox
Copy link

codesandbox bot commented Nov 9, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@ciampo ciampo self-assigned this Nov 9, 2022
@ciampo ciampo added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Nov 9, 2022
@ciampo ciampo marked this pull request as ready for review November 9, 2022 21:11
@ciampo ciampo changed the title TabPanel: add handleTabSelection to the list of hook deps to fix the exhaustive-deps warning TabPanel: fix the exhaustive-deps warning Nov 9, 2022
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 🚀

@ciampo ciampo enabled auto-merge (squash) November 10, 2022 20:25
@ciampo ciampo merged commit 148f089 into trunk Nov 10, 2022
@ciampo ciampo deleted the fix/tabpabel-exhaustive-deps branch November 10, 2022 21:27
@github-actions github-actions bot added this to the Gutenberg 14.6 milestone Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants