Skip to content

Conversation

ciampo
Copy link
Contributor

@ciampo ciampo commented Nov 11, 2022

What?

Fix the exhaustive-deps warning in the ToolsPanelItem component

Related to #45673 (which introduced the changes causing the warning)

Why?

Because #41166

How?

Add isRegistered to the component's hook's list of dependencies.

Testing Instructions

  • run npx eslint --rule 'react-hooks/exhaustive-deps: warn' packages/components/src/tools-panel and make sure that no warnings are reported
  • Check the ToolsPanel component in both Storybook and the editor
  • In particular, make sure that no regressions are being introduced compared to the fix from ToolsPanel: Prevent calling deselect when panel remounts #45673

@ciampo ciampo added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Nov 11, 2022
@ciampo ciampo self-assigned this Nov 11, 2022
@ciampo ciampo requested a review from ajitbohra as a code owner November 11, 2022 00:24
@codesandbox
Copy link

codesandbox bot commented Nov 11, 2022

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

Copy link
Contributor

@aaronrobertshaw aaronrobertshaw left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this @ciampo!

My bad for missing it in the first place 🤦

✅ No exhaustive-deps warnings after checking out this PR
✅ ToolsPanel continues to function in the editors and storybook
✅ Fix preventing the calling of onDeselect when the panel remounts still works (#45715)

@aaronrobertshaw aaronrobertshaw merged commit cff6d70 into trunk Nov 14, 2022
@aaronrobertshaw aaronrobertshaw deleted the fix/tools-panel-exhaustive-deps branch November 14, 2022 01:53
@github-actions github-actions bot added this to the Gutenberg 14.6 milestone Nov 14, 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