Sub registry stores don't use store plugins #24542
Labels
[Package] Core data
/packages/core-data
[Type] Bug
An existing feature does not function as intended
[Type] Question
Questions about the design or development of the editor.
When Gutenberg is loaded there is a bit of PHP inserted code that sets up the core stores to use the persistence plugin.
wp.data.use( wp.data.plugins.persistence )
This works fine for the core editor, and is used to get data from
localStorage
that is then used forinsertUsage
to determine the order of blocks in the block inserter.If you use
<BlockEditorProvider>
outside of the full editor (for example, the Gutenberg playground) and you try and use theuseSubRegistry
option to get a separate registry then it doesn't use the persistence plugin as it is a new registry and the plugin hasn't been applied.This means
withRegistryProvider
(which<BlockEditorProvider>
uses) creates a newcore/block-editor
store without persistence, and this results in theinsertUsage
settings not being used in any editor that sits inside the provider.Ideally if you use
useSubRegistry
then it should behave the same as the main registry, and any plugins should be copied across. Failing that,withRegistryProvider
should have a way to enable the plugins to be applied.However, after reading the comments in
registry.js
it seems thatuse
and store plugins are deprecated anyway. I don't know what the intention is with the persistence plugin, and what the replacement will be, and ifuseSubRegistry
will even continue being supported.As such I've labelled this as a 'question bug' as I'm not quite sure where it fits.
The text was updated successfully, but these errors were encountered: