From dfaa3e13fc30695b472f08a9c5b37c0d8b77360a Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Thu, 4 May 2023 12:11:51 +0100 Subject: [PATCH] Auto-create fallback on Sidebar init --- .../src/components/sidebar-navigation-screen-main/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js index 8f419c09196666..5769d9640dcf1a 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js @@ -17,6 +17,11 @@ import SidebarNavigationScreen from '../sidebar-navigation-screen'; import SidebarNavigationItem from '../sidebar-navigation-item'; export default function SidebarNavigationScreenMain() { + const { getNavigationFallbackId } = useSelect( coreStore ); + + // Immediately trigger creation/fetching of fallback. + getNavigationFallbackId(); + const hasNavigationMenus = useSelect( ( select ) => { // The query needs to be the same as in the "SidebarNavigationScreenNavigationMenus" component, // to avoid double network calls. @@ -32,7 +37,7 @@ export default function SidebarNavigationScreenMain() { ); return navigationMenus?.length > 0; - } ); + }, [] ); const showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN ? hasNavigationMenus