If we do not have the same registered blocks per post types the registry will be updated without all the available blocks.
Here a basic example:
If I have 3 available blocks core/heading, core/paragraph and custom/section.
Let's assume I do not need the custom/section in the Post post-type, therefore I have some custom code to checks if the current post type in the editor is post, and if so I unregister the custom/section block.
This means that when the registerBlockRegistryUpdate plugin run, it retrieves the available blocks, in this situation two blocks, and make the block registry to be updated with these 2 blocks.
But now I if I open the editor to edit a page, my custom code does not unregister the section block, and the registerBlockRegistryUpdate updates the registry with 3 blocks.
This is really a basic example where I have 1 missing block in the registry if the last content update was a Post.
But in my real usage I have more than 100 available blocks that can be available for one or many post types. I end up with sometimes 22 blocks in the registry, or 50 or more than a 100 when I manually hit the "Update block registry" button in the setting page.
My quick fix is then to I disabled the two editor plugins which updated the block registry with the current post type registered blocks.
If we do not have the same registered blocks per post types the registry will be updated without all the available blocks.
Here a basic example:
If I have 3 available blocks
core/heading
,core/paragraph
andcustom/section
. Let's assume I do not need thecustom/section
in the Post post-type, therefore I have some custom code to checks if the current post type in the editor is post, and if so I unregister thecustom/section
block.This means that when the
registerBlockRegistryUpdate
plugin run, it retrieves the available blocks, in this situation two blocks, and make the block registry to be updated with these 2 blocks.But now I if I open the editor to edit a page, my custom code does not unregister the section block, and the
registerBlockRegistryUpdate
updates the registry with 3 blocks.This is really a basic example where I have 1 missing block in the registry if the last content update was a Post.
But in my real usage I have more than 100 available blocks that can be available for one or many post types. I end up with sometimes 22 blocks in the registry, or 50 or more than a 100 when I manually hit the "Update block registry" button in the setting page.
My quick fix is then to I disabled the two editor plugins which updated the block registry with the current post type registered blocks.