From c053a1e07f4efddd78aa856dcdf52ac2a5516932 Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Thu, 11 May 2023 10:41:46 +0300 Subject: [PATCH] fix error on multi select --- .../block-switcher/block-variation-transformations.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-switcher/block-variation-transformations.js b/packages/block-editor/src/components/block-switcher/block-variation-transformations.js index 6207f6824e6aff..c2ec449dc61f94 100644 --- a/packages/block-editor/src/components/block-switcher/block-variation-transformations.js +++ b/packages/block-editor/src/components/block-switcher/block-variation-transformations.js @@ -17,6 +17,8 @@ import { store as blockEditorStore } from '../../store'; import BlockIcon from '../block-icon'; import PreviewBlockPopover from './preview-block-popover'; +const EMPTY_OBJECT = {}; + export function useBlockVariationTransforms( { clientIds, blocks } ) { const { activeBlockVariation, blockVariationTransformations } = useSelect( ( select ) => { @@ -33,7 +35,7 @@ export function useBlockVariationTransforms( { clientIds, blocks } ) { const canRemove = canRemoveBlocks( clientIds, rootClientId ); // Only handle single selected blocks for now. if ( blocks.length !== 1 || ! canRemove ) { - return; + return EMPTY_OBJECT; } const [ firstBlock ] = blocks; return {