From 23f1adc833e2af5909554bbe735d7baeba2009ee Mon Sep 17 00:00:00 2001 From: yyh Date: Sun, 18 Jan 2026 23:47:48 +0800 Subject: [PATCH] fix: restore mobile sidebar collapse behavior after appDetail loads Merge the two sidebar useEffects to prevent race condition where appDetail loading could override the mobile collapse state. Now mobile always collapses regardless of when appDetail resolves. --- .../app/(appDetailLayout)/[appId]/layout-main.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx index 801d6cfd47..9f828c9001 100644 --- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx +++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/layout-main.tsx @@ -99,14 +99,14 @@ const AppDetailLayout: FC = (props) => { useEffect(() => { if (!appDetail) return - const localeMode = localStorage.getItem('app-detail-collapse-or-expand') || 'expand' - setAppSidebarExpand(localeMode) - }, [appDetail, setAppSidebarExpand]) - - useEffect(() => { - if (isMobile) + if (isMobile) { setAppSidebarExpand('collapse') - }, [isMobile, setAppSidebarExpand]) + } + else { + const localeMode = localStorage.getItem('app-detail-collapse-or-expand') || 'expand' + setAppSidebarExpand(localeMode) + } + }, [appDetail, isMobile, setAppSidebarExpand]) useEffect(() => { if (!appDetail || isLoadingCurrentWorkspace)