-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block Editor: Fix ZoomOutModeInserters
dependencies
#61908
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +1 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
@@ -51,8 +51,7 @@ function ZoomOutModeInserters() { | |||
} | |||
// reset insertion point when the block order changes | |||
setInserterIsOpened( true ); | |||
// eslint-disable-next-line react-hooks/exhaustive-deps | |||
}, [ blockOrder ] ); | |||
}, [ blockOrder, setInserterIsOpened ] ); |
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.
I'm pretty sure I added this because it was misbehaving, but I can't remember after all the changes. What happens theoretically when the function changes? We only want to reset it when the order changes, so maybe we have to check that in the effect.
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.
Will this ever happen? It looks like a stable reference to me, so I don't understand when it will change. Plus we also have the mounted check. Happy to abandon it if I'm missing something of course.
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.
Right, actions should be safe to list in dependencies. If they're not anymore, we might have a bigger problem 😅
P.S. It would be cool if linter treated Redux actions as state setters, but IIRC that involved a lot of work.
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.
Sure, if everything works fine. I could swear I added it for a reason 😅
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.
We don't know it's an action though, it's a setting, right? I don't love these "impure" dependencies that much tbh
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.
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.
What George said. Thanks for verifying it, folks 🙌
Flaky tests detected in 9aa58b8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9209487465
|
Co-authored-by: tyxla <[email protected]> Co-authored-by: ellatrix <[email protected]> Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: tyxla <[email protected]> Co-authored-by: ellatrix <[email protected]> Co-authored-by: Mamaduka <[email protected]>
What?
This PR fixes the dependencies of one of
ZoomOutModeInserters
'suseEffect
calls.Why?
From what I understand, there is no good reason not to provide
setInserterIsOpened
as a dependency:setInserterIsOpened
reference is a stable reference to a block editor store action function.The motivation is resolving an ESLint error that was raised by the React Compiler ESLint plugin in #61788
How?
By adding
setInserterIsOpened
as a dependency and removing the ESLint rule disabling.Testing Instructions
trunk
(they look broken btw, but I'm not 100% sure how they are expected to look and work, cc @youknowriad)Testing Instructions for Keyboard
None
Screenshots or screencast
None