Skip to content

Commit

Permalink
Pattern: Don't render block controls when an entity is missing (#65028)
Browse files Browse the repository at this point in the history
* Pattern: Don't render block controls when an entity is missing
* Reference correct 'ButtonBlockAppender'

Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
Mamaduka and Mamaduka authored Sep 4, 2024
1 parent 3a310c4 commit d179303
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/block-library/src/block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
privateApis as blockEditorPrivateApis,
store as blockEditorStore,
BlockControls,
InnerBlocks,
} from '@wordpress/block-editor';
import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
import { store as blocksStore } from '@wordpress/blocks';
Expand Down Expand Up @@ -254,7 +255,9 @@ function ReusableBlockEdit( {
value: innerBlocks.length > 0 ? innerBlocks : blocks,
onInput: NOOP,
onChange: NOOP,
renderAppender: blocks?.length ? undefined : blocks.ButtonBlockAppender,
renderAppender: blocks?.length
? undefined
: InnerBlocks.ButtonBlockAppender,
} );

const handleEditOriginal = () => {
Expand Down Expand Up @@ -292,7 +295,7 @@ function ReusableBlockEdit( {

return (
<>
{ hasResolved && (
{ hasResolved && ! isMissing && (
<ReusableBlockControl
recordId={ ref }
canOverrideBlocks={ canOverrideBlocks }
Expand Down

0 comments on commit d179303

Please sign in to comment.