From dabadf1b43f73e07db7bb823b7ce0cd56343d090 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 27 Jul 2025 23:05:48 +0200 Subject: [PATCH] Reset nav bar width on override --- .../components/DefaultNavBar.tsx | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/modules/navigation-bar/components/DefaultNavBar.tsx b/src/modules/navigation-bar/components/DefaultNavBar.tsx index 3e34490f..da7ff7c7 100644 --- a/src/modules/navigation-bar/components/DefaultNavBar.tsx +++ b/src/modules/navigation-bar/components/DefaultNavBar.tsx @@ -43,19 +43,6 @@ export function DefaultNavBar() { } = useMetadataServerSettings(); const appBarRef = useRef(null); - useResizeObserver( - appBarRef, - useCallback(() => { - setAppBarHeight(appBarRef.current?.clientHeight ?? 0); - }, [appBarRef.current]), - ); - useLayoutEffect(() => { - if (!override.status) { - setAppBarHeight(0); - } - - return () => setAppBarHeight(0); - }, [override.status]); const isMainRoute = NAVIGATION_BAR_ITEMS.some(({ path, show }) => { if (isMobileWidth && show === 'desktop') { @@ -87,6 +74,25 @@ export function DefaultNavBar() { [NavBarComponent, visibleNavBarItems], ); + useResizeObserver( + appBarRef, + useCallback(() => { + setAppBarHeight(appBarRef.current?.clientHeight ?? 0); + }, [appBarRef.current]), + ); + + useLayoutEffect(() => { + if (override.status) { + setAppBarHeight(0); + setNavBarWidth(0); + } + + return () => { + setAppBarHeight(0); + setNavBarWidth(0); + }; + }, [override.status]); + useLayoutEffect(() => { if (!isMobileWidth) { // do not reset navbar width to prevent grid from jumping due to the changing grid item width