From bb3a6b578453800edfb61efc75804610f51305b6 Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Fri, 28 Jul 2023 10:36:03 +0200 Subject: [PATCH 1/2] BlockVariationPicker: remove unused withSelect --- .../block-variation-picker/index.native.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/block-editor/src/components/block-variation-picker/index.native.js b/packages/block-editor/src/components/block-variation-picker/index.native.js index e794a4bbba2089..b29f41d523773f 100644 --- a/packages/block-editor/src/components/block-variation-picker/index.native.js +++ b/packages/block-editor/src/components/block-variation-picker/index.native.js @@ -12,12 +12,9 @@ import { /** * WordPress dependencies */ -import { withSelect, useDispatch } from '@wordpress/data'; -import { compose, usePreferredColorSchemeStyle } from '@wordpress/compose'; -import { - createBlocksFromInnerBlocksTemplate, - store as blocksStore, -} from '@wordpress/blocks'; +import { useDispatch } from '@wordpress/data'; +import { usePreferredColorSchemeStyle } from '@wordpress/compose'; +import { createBlocksFromInnerBlocksTemplate } from '@wordpress/blocks'; import { __ } from '@wordpress/i18n'; import { PanelBody, @@ -116,12 +113,4 @@ function BlockVariationPicker( { isVisible, onClose, clientId, variations } ) { ); } -export default compose( - withSelect( ( select, {} ) => { - const { getBlockVariations } = select( blocksStore ); - - return { - date: getBlockVariations( 'core/columns', 'block' ), - }; - } ) -)( BlockVariationPicker ); +export default BlockVariationPicker; From e035f76195a87c3b070cefb7c521bc786a490006 Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Fri, 28 Jul 2023 10:39:20 +0200 Subject: [PATCH 2/2] BlockVariationPicker: remove unneeded useMemo --- .../block-variation-picker/index.native.js | 105 ++++++++---------- 1 file changed, 48 insertions(+), 57 deletions(-) diff --git a/packages/block-editor/src/components/block-variation-picker/index.native.js b/packages/block-editor/src/components/block-variation-picker/index.native.js index b29f41d523773f..b60c7a414d22d4 100644 --- a/packages/block-editor/src/components/block-variation-picker/index.native.js +++ b/packages/block-editor/src/components/block-variation-picker/index.native.js @@ -23,7 +23,6 @@ import { InserterButton, } from '@wordpress/components'; import { Icon, close } from '@wordpress/icons'; -import { useMemo } from '@wordpress/element'; /** * Internal dependencies @@ -42,28 +41,25 @@ function BlockVariationPicker( { isVisible, onClose, clientId, variations } ) { styles.cancelButtonDark ); - const leftButton = useMemo( - () => ( - - - { isIOS ? ( - - { __( 'Cancel' ) } - - ) : ( - - ) } - - - ), - [ onClose, cancelButtonStyle ] + const leftButton = ( + + + { isIOS ? ( + + { __( 'Cancel' ) } + + ) : ( + + ) } + + ); const onVariationSelect = ( variation ) => { @@ -74,42 +70,37 @@ function BlockVariationPicker( { isVisible, onClose, clientId, variations } ) { onClose(); }; - return useMemo( - () => ( - + - - { variations.map( ( v ) => { - return ( - onVariationSelect( v ) } - /> - ); - } ) } - - - ( + onVariationSelect( v ) } /> - - - ), - [ variations, isVisible, onClose ] + ) ) } + + + + + ); }