Introduce ExperimentalBlockEditorProvider#47319
Conversation
packages/editor/src/index.js
Outdated
| import { ExperimentalEditorProvider } from './components/provider'; | ||
| import { lock } from './experiments'; | ||
|
|
||
| export const experiments = {}; |
There was a problem hiding this comment.
This export is in here and not in experiments.js to avoid a circular dependency between experiments.js and ./components/provider/index.ts
There was a problem hiding this comment.
I'd prefer this to be consistent across packages so maybe we should export experiments from index.js in all the other packages too?
Or split experiments.js into experiments.js and lock-unlock.js.
There was a problem hiding this comment.
Agreed, let's make it consistent across packages. That's out of scope here, though – let's do it in a follow up PR
|
Size Change: +894 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
2513840 to
2c0f39a
Compare
|
Flaky tests detected in 9e1fa36. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4016530130
|
|
I added unit tests. There's still a problem with the native tests. |
|
This PR is blocked by #47421 |
718cc49 to
f50bb1f
Compare
This PR introduces `ExperimentalBlockEditorProvider` that prevents mixing experimental editor settings and the public `BlockEditorProvider` component. The actual filtering is handled in a private `__experimentalUpdateSettings` selector in the block-editor store. Experimental settings may still be set via a PHP plugin – limiting this vector would require a separate PR.
f50bb1f to
cc28354
Compare
ntsekouras
left a comment
There was a problem hiding this comment.
This LGTM! We'll wait for mobile folks to test the native files' changes and we can 🚢 .
Thanks Adam!
jhnstn
left a comment
There was a problem hiding this comment.
Changes look good. I didn't notice any issues running the changes in the mobile demo app.
Description
This PR introduces
ExperimentalBlockEditorProviderthat prevents mixing experimental editor settings and the publicBlockEditorProvidercomponent. The actual filtering is handled in a private__experimentalUpdateSettingsselector in the block-editor store.Experimental settings may still be set via a PHP plugin – limiting this vector would require a separate PR.
Rationale
WordPress extenders cannot update the experimental block settings on their own. The
updateSettings()actions of the@wordpress/block-editorstore will filter out all the settings that are not a part of the public API. The only way to actually store them is via private action.__experimentalUpdateSettings().To privatize a block editor setting, add it to the
privateSettingslist in/packages/block-editor/src/store/actions.js:
Mobile apps
This PR updates a few
.native.jsfiles. Mobile apps choose to import the.native.jsfiles over their.jscounterparts whenever possible. At the same time, this PR introduced the expectation of having two extra named exports:ExperimentalEditorProviderandExperimentalBlockEditorProvider. I updated the native files to export the regular Provider component under the experimental name. This works because the settings filtering is restricted to the web – it doesn't make sense in context of mobile apps anyway.Testing instructions
cc @ntsekouras @youknowriad