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

Patterns: Avoid showing block removal warning when deleting a pattern instance that has overrides #59044

Merged
merged 2 commits into from
Feb 15, 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
9 changes: 9 additions & 0 deletions packages/block-editor/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ export const privateRemoveBlocks =
}

if ( rules[ 'bindings/core/pattern-overrides' ] ) {
const parentPatternBlocks =
select.getBlockParentsByBlockName(
clientId,
'core/block'
);
// We only need to run this check when editing the original pattern, not pattern instances.
if ( parentPatternBlocks?.length > 0 ) {
continue;
}
Comment on lines +143 to +151
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess another way is to only have the pattern overrides rule when within a pattern.

No real preference here, but I think it might affect the follow up that's underway.

const blockAttributes =
select.getBlockAttributes( clientId );
if (
Expand Down
Loading