-
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: Fix the 'useUpdateEffect' hook in strict mode #62974
Conversation
Size Change: +14 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
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. |
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.
Nice detective work @Mamaduka, thanks for following up!
✅ The widgets editor in the customizer no longer scrolls away when interacting with blocks
✅ The focal point picker is working for the Cover block and background image block support in the post and site editors
✅ Did a quick smoke check of other design tools, etc to make sure nothing else seems to break
LGTM! 🚀
Looks like there's a small conflict in the changelog that'll need to be resolved before merge.
Thanks @Mamaduka, this tests well for me too. |
f75f360
to
d566494
Compare
Nice, thanks @Mamaduka 🙌 |
…62974) * Components: Fix the 'useUpdateEffect' hook in strict mode * Add changelong entry Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org>
What?
PR fixes the
useUpdateEffect
hook to avoid running effects on the mount when the strict mode is enabled.Fixes: #62898.
Fixes: a bug in
FocalPointPicker
displaying a grid overlay on the mount. It should only be visible when changing the values.Why?
The hook didn't account for the extra run in strict mode.
Note: The hook is used by the panel body component and handles "scroll-into-view" after the initial render. The bug was only visible in the Customize > Widgets editor.
gutenberg/packages/components/src/panel/body.tsx
Lines 62 to 80 in 237e09d
How?
Sync the fix from the Ariakit library - packages/ariakit-utils/src/hooks.ts
Testing Instructions
Customize Widgets
Focal Pointer
Testing Instructions for Keyboard
Sames
Screenshots or screencast
CleanShot.2024-06-28.at.17.06.17.mp4