-
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
Updating the BlockEditorProvider settings prop should reset the store's settings entirely #51904
Conversation
…'s setting entirely
Size Change: +1.31 kB (0%) Total Size: 1.44 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.
Tested against original bug and works as expected.
Thank you 🙇♂️
stripExperimentalSettings = false, | ||
reset = false |
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.
stripExperimentalSettings = false, | |
reset = false | |
{ | |
stripExperimentalSettings = false, | |
reset = false | |
} |
Nit: these positional arguments are growing and require reading the source of the function in order to understand what a given call is doing.
For example what does true
do here (I know the answer but only because I'm reviewing this PR)?
__experimentalUpdateSettings(
{
...settings,
__internalIsInitialized: true,
},
stripExperimentalSettings
stripExperimentalSettings,
true
);
Perhaps we can consider rewriting to use an object?
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, it's a private action though, we can change our mind at any time.
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.
Doesn't need to happen now of course.
Flaky tests detected in fd15da0. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5389827490
|
Thank you 🥇 |
…'s settings entirely (WordPress#51904) Co-authored-by: Dave Smith <[email protected]>
closes #51489
What?
If you render a block editor provider with a special setting (like template) and then you update your prop and omit that particular setting, you expect that setting to restore to the default value (undefined) instead of retaining the previous prop value. This PR ensures that any change to the
settings
prop ofBlockEditorProvider
actually resets the settings entirely.This bug was discovered in #39286 (comment)
Testing Instructions
Switch between "Navigation" and other entities in the site editor (templates). Template locking should remain active when doing so. You should be able to edit top level blocks in the template.