-
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
EntityProvider: Avoid remounts and simplify #61882
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: -67 B (0%) Total Size: 1.74 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.
I tested and it fixes the issue. Code looks much nicer too.
This is just the fix I hoped for! Those remounts could have been potential problems in many other cases. 🚀
Flaky tests detected in dd7e118. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9198861064
|
Thanks for raising these issues @stokesman |
Co-authored-by: youknowriad <[email protected]> Co-authored-by: stokesman <[email protected]>
Co-authored-by: youknowriad <[email protected]> Co-authored-by: stokesman <[email protected]>
closes #61875
Alternative to #61874
What?
While debugging #61875 I noticed that the EditorProvider remounts its children when the "entity" changes (for instance when moving from a template to a template part). The reason for this is a poor implementation of the
EntityProvider
component. It was basically using some complex code to use a separate React context per entity.The current PR simplifies things a bit by using the same provider and hold all the "entity providers" in it. Personally, I think ultimately, we should seek to deprecate the EntityProviders entirely in favor of Block Context. It was a bad idea that stuck but that's for another time.
Testing Instructions
1- Open the site editor
2- Select a template part and click "edit"
3- The document bar should animate forward
4- Click "back" on the document bar and it should animate backwards.