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 21, 2022
1 parent 1bf3b85 commit 2178750
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 @@ -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
Expand Down

0 comments on commit 2178750

Please sign in to comment.