mirror of
https://github.com/langgenius/dify.git
synced 2026-03-25 00:07:56 +08:00
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.
This commit is contained in:
@ -99,14 +99,14 @@ const AppDetailLayout: FC<IAppDetailLayoutProps> = (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)
|
||||
|
||||
Reference in New Issue
Block a user