diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index 751d33b9b501f4..6cb773e60107bd 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -282,16 +282,18 @@ function Navigation( { hasResolvedNavigationMenus && ! hasUncontrolledInnerBlocks; - if ( isPlaceholder && ! ref ) { - /** - * this fallback only displays (both in editor and on front) - * the list of pages block if no menu is available as a fallback. - * We don't want the fallback to request a save, - * nor to be undoable, hence we mark it non persistent. - */ - __unstableMarkNextChangeAsNotPersistent(); - replaceInnerBlocks( clientId, [ createBlock( 'core/page-list' ) ] ); - } + useEffect( () => { + if ( isPlaceholder && ! ref ) { + /** + * this fallback only displays (both in editor and on front) + * the list of pages block if no menu is available as a fallback. + * We don't want the fallback to request a save, + * nor to be undoable, hence we mark it non persistent. + */ + __unstableMarkNextChangeAsNotPersistent(); + replaceInnerBlocks( clientId, [ createBlock( 'core/page-list' ) ] ); + } + }, [ clientId, isPlaceholder, ref ] ); const isEntityAvailable = ! isNavigationMenuMissing && isNavigationMenuResolved;