Skip to content

Commit

Permalink
Memoise post content block.
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Sep 20, 2022
1 parent f110f63 commit 0d193ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,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
Expand Down

0 comments on commit 0d193ca

Please sign in to comment.