Skip to content

Commit

Permalink
Auto-create fallback on Sidebar init
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed May 4, 2023
1 parent a6ed9ff commit dfaa3e1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -32,7 +37,7 @@ export default function SidebarNavigationScreenMain() {
);

return navigationMenus?.length > 0;
} );
}, [] );

const showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN
? hasNavigationMenus
Expand Down

0 comments on commit dfaa3e1

Please sign in to comment.