Skip to content

Commit

Permalink
marks not persistent system actions for nesting effects (#47633)
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu authored Feb 3, 2023
1 parent ddcaa70 commit 7d8c488
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ export default function NavigationLinkEdit( {
useEffect( () => {
// If block has inner blocks, transform to Submenu.
if ( hasChildren ) {
// This side-effect should not create an undo level as those should
// only be created via user interactions.
__unstableMarkNextChangeAsNotPersistent();
transformToSubmenu();
}
}, [ hasChildren ] );
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/navigation-submenu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ export default function NavigationSubmenuEdit( {
useEffect( () => {
// If block becomes empty, transform to Navigation Link.
if ( ! hasChildren && prevHasChildren ) {
// This side-effect should not create an undo level as those should
// only be created via user interactions.
__unstableMarkNextChangeAsNotPersistent();
transformToLink();
}
}, [ hasChildren, prevHasChildren ] );
Expand Down

1 comment on commit 7d8c488

@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 7d8c488.
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/4087404393
📝 Reported issues:

Please sign in to comment.