Open ghost opened 3 years ago
Describe the bug I build custom websites for clients. In order to do that, I need to disable all core blocks and only enable my own custom blocks, or reusable blocks made using those custom ones.
I have the following code:
wp.domReady( () => { wp.blocks.getBlockTypes().forEach( blockType => { if( ! ( blockType.category === 'custom' || blockType.category === 'reusable' ) ) { wp.blocks.unregisterBlockType( blockType.name ); } }); } );
This takes about 3.3 seconds to complete. During that time, the editor load process is blocked.
To reproduce Paste the above code in a js file and enqueue it for the block editor.
Expected behavior I understand that unregistering so many blocks creates some overhead, but I imagine it can be done faster.
Editor version (please complete the following information):
Desktop (please complete the following information):
Curious, not sure why it takes so long, but could be worth profiling.
Describe the bug I build custom websites for clients. In order to do that, I need to disable all core blocks and only enable my own custom blocks, or reusable blocks made using those custom ones.
I have the following code:
This takes about 3.3 seconds to complete. During that time, the editor load process is blocked.
To reproduce Paste the above code in a js file and enqueue it for the block editor.
Expected behavior I understand that unregistering so many blocks creates some overhead, but I imagine it can be done faster.
Editor version (please complete the following information):
Desktop (please complete the following information):