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 and ntsekouras committed Feb 21, 2023
1 parent 4494f13 commit 9fa1e90
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

0 comments on commit 9fa1e90

Please sign in to comment.