Avoid rerenders of the entire BlockInspector when block attributes change#21990
Avoid rerenders of the entire BlockInspector when block attributes change#21990
Conversation
|
Size Change: +2 B (0%) Total Size: 819 kB
ℹ️ View Unchanged
|
|
@youknowriad This PR combined with #21973 fixes the performance issue even without the |
|
@adamziel Thanks for your work, these improvements are great. I'll take a look at this PR a bit later but keeping "memo" is totally fine. Good point about BlockStyles being expensive, that said, I wonder if the expensive component is actually BlockPreview used by BlockStyles and not BlockStyles itself so I wonder whether we should move the "memo" there. |
|
Thank you!
@youknowriad Good point! I'll merge #21973 and spin a new PR for that. |
youknowriad
left a comment
There was a problem hiding this comment.
I didn't really test the performance impact here but the changes look good regardless.
|
Awesome, thank you so much! Also, that new PR to |
Description
BlockInspectorusesuseSlot( InspectorAdvancedControls.slotName ). Whenever any fill is updated, the entire BlockInspector is re-rendered. This causes performance problems like the ones described in #21973. This PR extracts theInspectorAdvancedControlsfills into a sub-component to avoid re-rendering the entire inspector.How has this been tested?
For some reason, my react dev tools fail to capture the re-render of
BlockInspector. This makes testing a little bit harder, but not impossible:console.log("BlockInspector rendered")as a first statement in theBlockInspectorcomponentBlockInspector renderedwas logged about 10 times.BlockInspector renderedwas not logged in response to changing the backgroundTypes of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: