From 217875022cbbc9307315b19a697643fc2ede10b3 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 20 Sep 2022 17:04:39 +1000 Subject: [PATCH] Memoise post content block. --- packages/edit-post/src/components/visual-editor/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/edit-post/src/components/visual-editor/index.js b/packages/edit-post/src/components/visual-editor/index.js index a2c6f668d1f69..7fd62709b5754 100644 --- a/packages/edit-post/src/components/visual-editor/index.js +++ b/packages/edit-post/src/components/visual-editor/index.js @@ -221,8 +221,10 @@ export default function VisualEditor( { styles } ) { return { type: 'default' }; }, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] ); - const templateBlocks = parse( templateContent ); - const postContentBlock = findPostContent( templateBlocks ); + const postContentBlock = useMemo( () => { + return findPostContent( parse( templateContent ) ); + }, [ templateContent ] ); + const postContentLayoutClasses = useLayoutClasses( postContentBlock?.attributes?.layout, globalLayoutSettings?.definitions