Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern: Don't render block controls when an entity is missing #65028

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An incorrect search-replace from #60721.

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
Loading