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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(chat): broadcast renames across windows so sidebar stays in sync
Louis Beaumont3def664660b2
diff --git a/apps/screenpipe-app-tauri/components/hooks/use-chat-conversations.ts b/apps/screenpipe-app-tauri/components/hooks/use-chat-conversations.tsindex adbc55c9d..6da002d16 100644--- a/apps/screenpipe-app-tauri/components/hooks/use-chat-conversations.ts+++ b/apps/screenpipe-app-tauri/components/hooks/use-chat-conversations.ts@@ -313,6 +313,17 @@ export function useChatConversations(opts: UseChatConversationsOpts) {} catch (e) {console.warn("[chat] failed to sync rename to store:", e);}+ // Broadcast across windows. The chat-store is window-local (zustand+ // lives in each WebView's JS context); without this, renaming in the+ // /chat overlay window never reaches the chat-sidebar in /home (and+ // vice versa) until the next on-disk hydration. Listeners in+ // standalone-chat.tsx patch their local store on receipt.+ try {+ const { emit } = await import("@tauri-apps/api/event");+ await emit("chat-renamed", { id: convId, title: trimmed });+ } catch (e) {+ console.warn("[chat] failed to broadcast rename:", e);+ }};// ---- deleteConversation ----diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsxindex a48874181..f5c7bbdaa 100644--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx@@ -1952,6 +1952,29 @@ export function StandaloneChat({useChatStore.getState().actions.setPanelSession(conversationId);}, [conversationId]);+ // Cross-window rename sync. The chat-store is window-local (zustand+ // lives in each WebView's JS context), so a rename done in the /chat+ // overlay would otherwise never reach the chat-sidebar in /home. The+ // canonical rename path (`renameConversation` in use-chat-conversations)+ // emits this event to all windows; we patch the local store on receipt.+ // Self-receipt is a harmless idempotent no-op (patch sets the same+ // title we just wrote).+ useEffect(() => {+ const unlisten = listen<{ id: string; title: string }>(+ "chat-renamed",+ (event) => {+ const { id, title } = event.payload;+ if (!id || !title) return;+ if (useChatStore.getState().sessions[id]) {+ useChatStore.getState().actions.patch(id, { title });+ }+ },+ );+ return () => {+ unlisten.then((fn) => fn()).catch(() => {});+ };+ }, []);+// Component-lifetime guard for bus handlers that fire across the// longer-lived useEffects (terminated, foreground registrations).// Useful because the panel's per-effect `mounted` flags are scoped