Skip to content

Commit

Permalink
Patterns: Check we are not within a pattern instance before running b…
Browse files Browse the repository at this point in the history
…lock deletion rules (#59044)

* Check we are not within a pattern instance before running block deletion rules on overridden blocks

* Make comment more explanatory

Co-authored-by: glendaviesnz <glendaviesnz@git.wordpress.org>
Co-authored-by: talldan <talldanwp@git.wordpress.org>
  • Loading branch information
3 people authored Feb 15, 2024
1 parent ac607f4 commit a988b90
Showing 1 changed file with 9 additions and 0 deletions.
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;
}
const blockAttributes =
select.getBlockAttributes( clientId );
if (
Expand Down

1 comment on commit a988b90

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in a988b90.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7912152172
📝 Reported issues:

Please sign in to comment.