Currently, the components that are responsible for editing blocks are (quasi) controlled -- they are passed a blockContent object which represents the latest edited state of a block's content (like its js logic and other metadata). These block-editing components are also passed a setter (setBlockContent) which is used to change the object they are passed. This is causing a number of unnecessary renders to be triggered because this blockContent object is constantly changing (sometimes on keystroke!).
Refactor the data flow of these block editors and the Block data flow to avoid unnecessary rerenders and make the components of Blocks (renderer, simple ui, adapter) less reliant on lots of props from ancestors so that they are easier to implement as plugins in the future.
Some things to do:
Currently, the components that are responsible for editing blocks are (quasi) controlled -- they are passed a
blockContentobject which represents the latest edited state of a block's content (like its js logic and other metadata). These block-editing components are also passed a setter (setBlockContent) which is used to change the object they are passed. This is causing a number of unnecessary renders to be triggered because thisblockContentobject is constantly changing (sometimes on keystroke!).Refactor the data flow of these block editors and the
Blockdata flow to avoid unnecessary rerenders and make the components of Blocks (renderer, simple ui, adapter) less reliant on lots of props from ancestors so that they are easier to implement as plugins in the future.Some things to do:
blockContentsosetBlockContentcallback does not trigger so many rerendersblockContentpropBlockPreviewso that all blocks are varSwapped, mortarEval'd, then adapted