From e57c53b8e9e2344c26c8dcdc14e5d57448b83cc9 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:15:56 +0300 Subject: [PATCH] Block Editor: Cleanup AutoBlockPreview render memoization of BlockList --- packages/block-editor/src/components/block-preview/auto.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/block-editor/src/components/block-preview/auto.js b/packages/block-editor/src/components/block-preview/auto.js index 0f04a68dd61a82..835f379c09b987 100644 --- a/packages/block-editor/src/components/block-preview/auto.js +++ b/packages/block-editor/src/components/block-preview/auto.js @@ -15,7 +15,7 @@ import EditorStyles from '../editor-styles'; import { store } from '../../store'; // This is used to avoid rendering the block list if the sizes change. -let MemoizedBlockList; +const MemoizedBlockList = memo( BlockList ); const MAX_HEIGHT = 2000; const EMPTY_ADDITIONAL_STYLES = []; @@ -55,9 +55,6 @@ function ScaledBlockPreview( { return styles; }, [ styles, additionalStyles ] ); - // Initialize on render instead of module top level, to avoid circular dependency issues. - MemoizedBlockList = MemoizedBlockList || memo( BlockList ); - const scale = containerWidth / viewportWidth; const aspectRatio = contentHeight ? containerWidth / ( contentHeight * scale )