Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Check we are not within a pattern instance before running block delet…
…ion rules on overridden blocks
  • Loading branch information
glendaviesnz committed Feb 14, 2024
commit 114537b815bbd080e9a3f72a3d392d5fa27602b8
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'
);
// If the overriden block is a child of a core/block, skip it.
if ( parentPatternBlocks?.length > 0 ) {
continue;
}
Comment on lines +143 to +151
Copy link
Copy Markdown
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