Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

stop sidebar from reopening after chat switch (#3979)

Harsh Kumara2028938b52e
diff --git a/apps/screenpipe-app-tauri/components/browser-sidebar.tsx b/apps/screenpipe-app-tauri/components/browser-sidebar.tsx
index f35a96a0b..5210cdfa2 100644
--- a/apps/screenpipe-app-tauri/components/browser-sidebar.tsx
+++ b/apps/screenpipe-app-tauri/components/browser-sidebar.tsx
@@ -324,12 +324,20 @@ export function BrowserSidebar({ conversationId }: BrowserSidebarProps) {
setSessionAccessRequest(null);
setSessionAccessAnswer(null);
setV20CookieBlock(null);
- setVisible(true);
- setCollapsed(false);
setCurrentUrl(url);
setCurrentTitle(null);
setLoading(true);
- persistState({ url, collapsed: false });
+ // Agent-driven navigations (owner is set) always open the panel.
+ // Ownerless events (restore/reload after chat switch) must not
+ // override the persisted collapsed state — otherwise switching
+ // away from a chat with a collapsed sidebar and back re-opens it.
+ if (owner) {
+ setVisible(true);
+ setCollapsed(false);
+ persistState({ url, collapsed: false });
+ } else {
+ persistState({ url });
+ }
},
);
return () => {