-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Components: refactor AlignmentMatrixControl
to pass exhaustive-deps
#41167
Conversation
Size Change: +6 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM 🚀
Could you also add a CHANGELOG entry ?
Ata first glance e2e failures don't seem related, but let's take a deeper look in case they persist after rebasing
…. Update dependency array
5f94dcf
to
e872e6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pardon the noise with the suggestions/commits 🙇 I just wanted to make sure that the CHANGELOG entry would be under the Internal
section
We're good to merge as soon as CI is 🟢
…p-tests-config * 'trunk' of github.com:WordPress/gutenberg: (88 commits) Components: refactor `AlignmentMatrixControl` to pass `exhaustive-deps` (#41167) [RNMobile] Add 'Insert from URL' option to Image block (#40334) [RNMobile] Improvements to Getting Started Guides (#40964) Post Author Name: Add to and from Post Author transformations (#41151) CheckboxControl: Add unit tests (#41165) Improve inline documentation (#41209) Mobile Release v1.76.1 (#41196) Use explicit type definitions for entity configuration (#40995) Scripts: Convert file extension to js in `block.json` during build (#41068) Reflects revert in 6446878 (#41221) get_style_nodes should be compatible with parent method. (#41217) Gallery: Opt-in to axial (column/row) block spacing controls (#41175) Table of Contents block: convert line breaks to spaces in headings. (#41206) Add support for button elements to theme.json (#40260) Global Styles: Load block CSS conditionally (#41160) Update URL (#41188) Improve autocompleter performance (#41197) Site Editor: Set min-width for styles preview (#41198) Remove Navigation Editor screen from experiments page (#40878) Fix broken Page title for pages created inline within in Nav block (#41063) ...
What?
Updates the
AlignmentMatrixControl
component to satisfy theexhaustive-deps
eslint ruleWhy?
Part of the effort in #41166 to apply
exhuastive-deps
to the Components packageHow?
baseId
to theuseEffect
dependency arraycomposite.setCurrentId(...)
within the effect makescomposite
itself a dependency, because it gets called as thethis
value tosetCurrentId
. Addingcomposite
directly to the dependency array triggers a loop. Destructuringcomposite.setCurrentId
into its own variable before the effect allows us to rely on just that individual value in our dependency array, eliminate the loop while satisfying the linter.Testing Instructions
exhaustive-deps
eslint rule #41166, OR manually set'react-hooks/exhaustive-deps': 'warn'
in your local eslint filenpx eslint packages/components/src/alignment-matrix-control