Performance: Gutenberg block editor basics
MEDIUM IMPACT
This affects page load speed and interaction responsiveness when editing content in WordPress using the block editor.
wp.blocks.registerBlockType('myplugin/light-block', { edit: () => { /* simple React code with minimal dependencies */ }, save: () => { /* save markup */ } });
wp.blocks.registerBlockType('myplugin/heavy-block', { edit: () => { /* complex React code with many dependencies */ }, save: () => { /* save markup */ } });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy custom blocks with many dependencies | High (many nodes) | Multiple reflows on input | High paint cost due to complex UI | [X] Bad |
| Simple custom blocks with minimal dependencies | Low (few nodes) | Single reflow on input | Low paint cost with simple UI | [OK] Good |