WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.53k stars 4.21k forks source link

SlotFill: fix dependencies of registration effects, deduplicate code #67071

Closed jsnajdr closed 4 days ago

jsnajdr commented 4 days ago

This PR tidies up the code for a Fill registration and rendering.

For registration and unregistration, there used to be two effects: one runs on mount/unmount, another on name change. They can be easily merged into one with a [ name ] dependency. Registration and unregistration still happens at exactly the right times. And also the ref.current.name value is updated when name changes.

There's also a second effect that updates ref.current.children and rerenders the slot when children change. This one needs additional slot dependency. The slot object is constant the entire time a slot is mounted.

github-actions[bot] commented 4 days ago

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

jsnajdr commented 4 days ago

For some reason the e2es are failing repeatedly. It's a low level failure -- failed WP database connection.

github-actions[bot] commented 4 days ago

Flaky tests detected in 52f0c8fd8f5a1b1ac06f67e2b636db43bf831ad2. Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11892091496 📝 Reported issues: