From e9c7aefa6f9c574c485011c25a30b6efffbdca1e Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 21 Dec 2022 20:25:14 +0400 Subject: [PATCH] Gallery: Avoid creating new layout objects on every render --- packages/block-library/src/gallery/edit.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/gallery/edit.js b/packages/block-library/src/gallery/edit.js index 893167e6690f3..c56cf1dab84e8 100644 --- a/packages/block-library/src/gallery/edit.js +++ b/packages/block-library/src/gallery/edit.js @@ -65,6 +65,7 @@ const linkOptions = [ ]; const ALLOWED_MEDIA_TYPES = [ 'image' ]; const allowedBlocks = [ 'core/image' ]; +const LAYOUT = { type: 'default', alignments: [] }; const PLACEHOLDER_TEXT = Platform.isNative ? __( 'ADD MEDIA' ) @@ -489,7 +490,7 @@ function GalleryEdit( props ) { allowedBlocks, orientation: 'horizontal', renderAppender: false, - __experimentalLayout: { type: 'default', alignments: [] }, + __experimentalLayout: LAYOUT, } ); if ( ! hasImages ) {