From c5b62f31a8b5f954185a09658a1c7f681e0cc7db Mon Sep 17 00:00:00 2001 From: Gemini AI Date: Sat, 27 Dec 2025 12:36:25 +0400 Subject: [PATCH] feat(ui): add back button to session view and auto-clear active session on instance stop --- packages/ui/src/App.tsx | 45 ++++++++++--------- .../components/instance/instance-shell2.tsx | 10 ++++- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/packages/ui/src/App.tsx b/packages/ui/src/App.tsx index d16d90e..65dc973 100644 --- a/packages/ui/src/App.tsx +++ b/packages/ui/src/App.tsx @@ -217,6 +217,7 @@ const App: Component = () => { if (!confirmed) return + clearActiveParentSession(instanceId) await stopInstance(instanceId) } @@ -303,7 +304,7 @@ const App: Component = () => { const tauriBridge = (window as { __TAURI__?: { event?: { listen: (event: string, handler: (event: { payload: unknown }) => void) => Promise<() => void> } } }).__TAURI__ if (tauriBridge?.event) { let unlistenMenu: (() => void) | null = null - + tauriBridge.event.listen("menu:newInstance", () => { handleNewInstanceRequest() }).then((unlisten) => { @@ -321,7 +322,7 @@ const App: Component = () => { // Check if this is OAuth callback const isOAuthCallback = window.location.pathname === '/auth/qwen/callback' - + if (isOAuthCallback) { return } @@ -391,29 +392,29 @@ const App: Component = () => { onNew={handleNewInstanceRequest} onOpenRemoteAccess={() => setRemoteAccessOpen(true)} /> - + {(instance) => { const isActiveInstance = () => activeInstanceId() === instance.id const isVisible = () => isActiveInstance() && !showFolderSelection() - return ( -
- - handleCloseSession(instance.id, sessionId)} - onNewSession={() => handleNewSession(instance.id)} - handleSidebarAgentChange={(sessionId, agent) => handleSidebarAgentChange(instance.id, sessionId, agent)} - handleSidebarModelChange={(sessionId, model) => handleSidebarModelChange(instance.id, sessionId, model)} - onExecuteCommand={executeCommand} - tabBarOffset={instanceTabBarHeight()} - /> - + return ( +
+ + handleCloseSession(instance.id, sessionId)} + onNewSession={() => handleNewSession(instance.id)} + handleSidebarAgentChange={(sessionId, agent) => handleSidebarAgentChange(instance.id, sessionId, agent)} + handleSidebarModelChange={(sessionId, model) => handleSidebarModelChange(instance.id, sessionId, model)} + onExecuteCommand={executeCommand} + tabBarOffset={instanceTabBarHeight()} + /> + -
- ) +
+ ) }}
@@ -458,9 +459,9 @@ const App: Component = () => { - + setRemoteAccessOpen(false)} /> - +
+ {/* Compact Button */}