Skip to content

Commit

Permalink
Block Editor: Cleanup AutoBlockPreview render memoization of BlockList (
Browse files Browse the repository at this point in the history
WordPress#66060)

Co-authored-by: tyxla <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: sgomes <[email protected]>
  • Loading branch information
4 people authored Oct 11, 2024
1 parent 4f3da91 commit 26dfcb9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/block-editor/src/components/block-preview/auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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 )
Expand Down

0 comments on commit 26dfcb9

Please sign in to comment.