diff --git a/packages/block-editor/src/components/block-toolbar/block-toolbar-menu.native.js b/packages/block-editor/src/components/block-toolbar/block-toolbar-menu.native.js index bff035173b290..5b7e0c6fccc94 100644 --- a/packages/block-editor/src/components/block-toolbar/block-toolbar-menu.native.js +++ b/packages/block-editor/src/components/block-toolbar/block-toolbar-menu.native.js @@ -100,9 +100,11 @@ const BlockActionsMenu = ( { } = getMoversSetup( isStackedHorizontally, moversOptions ); // Check if selected block is Groupable and/or Ungroupable. - const convertToGroupButtonProps = useConvertToGroupButtonProps( [ - selectedBlockClientId, - ] ); + const convertToGroupButtonProps = useConvertToGroupButtonProps( + // `selectedBlockClientId` can be undefined in some cases where this + // component gets re-rendered right after the block is removed. + selectedBlockClientId ? [ selectedBlockClientId ] : [] + ); const { isGroupable, isUngroupable } = convertToGroupButtonProps; const showConvertToGroupButton = ( isGroupable || isUngroupable ) && canRemove;