Ryuiso 1 viikko sitten
vanhempi
commit
f1d58f33aa
1 muutettua tiedostoa jossa 7 lisäystä ja 4 poistoa
  1. 7 4
      app/components/sidebar.tsx

+ 7 - 4
app/components/sidebar.tsx

@@ -211,6 +211,9 @@ export const SideBar = (props: { className?: string }) => {
     globalStore.setShowMenu(false);
   };
 
+  // 统一的sidebar显示逻辑
+  const shouldShowSidebar = location.search.includes('showMenu=false') ? globalStore.showMenu : true;
+
   return (
     <>
       {
@@ -222,7 +225,7 @@ export const SideBar = (props: { className?: string }) => {
         )
       }
       {
-        (location.search.includes('showMenu=false') ? globalStore.showMenu : true) &&
+        shouldShowSidebar &&
         <SideBarContainer
           onDragStart={onDragStart}
           shouldNarrow={shouldNarrow}
@@ -255,9 +258,9 @@ export const SideBar = (props: { className?: string }) => {
                   chatStore.updateCurrentSession((value) => {
                     value.appId = globalStore.selectedAppId;
                   });
-                  if (isMobileScreen) {
-                    closeSidebar();
-                  }
+                  // 重置sidebar状态,避免跳转后状态异常
+                  globalStore.setShowMenu(false);
+                  
                   // 保留重要的URL参数
                   const currentParams = new URLSearchParams(location.search);
                   const preservedParams = new URLSearchParams();