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): new chat invisible in sidebar until app refresh (#3226)
Ansh Groverd247af9fe3de
diff --git a/apps/screenpipe-app-tauri/components/hooks/use-chat-conversations.ts b/apps/screenpipe-app-tauri/components/hooks/use-chat-conversations.tsindex d3f79ac6c..8e17cc407 100644--- a/apps/screenpipe-app-tauri/components/hooks/use-chat-conversations.ts+++ b/apps/screenpipe-app-tauri/components/hooks/use-chat-conversations.ts@@ -237,6 +237,12 @@ export function useChatConversations(opts: UseChatConversationsOpts) {useChatStore.getState().actions.patch(convId, {title: conversation.title,messageCount: conversation.messages.length,+ // Clear the draft flag on every save (including the 1.5s auto-save+ // during streaming). Without this, the sidebar hides the chat for+ // the entire streaming duration because the auto-save writes the+ // file to disk but never clears draft:true in the store — so the+ // chat appears on refresh (file exists) but not in the live sidebar.+ draft: false,...(conversation.lastUserMessageAt? { lastUserMessageAt: conversation.lastUserMessageAt }: {}),diff --git a/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts b/apps/screenpipe-app-tauri/lib/stores/pi-event-router.tsindex d2f1a4143..528ba745f 100644--- a/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts+++ b/apps/screenpipe-app-tauri/lib/stores/pi-event-router.ts@@ -731,6 +731,17 @@ async function persistBackgroundSession(sid: string): Promise<void> {try {await saveConversationFile(conv);+ // Mirror what use-chat-conversations.ts does on the foreground+ // isLoading edge: clear the draft flag so the sidebar shows this+ // chat immediately, without requiring a manual refresh. Without+ // this, navigating away from a new chat before the assistant+ // finishes leaves the session hidden (draft:true) in the sidebar+ // even though the file is already on disk.+ useChatStore.getState().actions.patch(sid, {+ draft: false,+ title: conv.title,+ messageCount: conv.messages.length,+ });} catch (e) {console.warn("[router] background save failed for", sid, e);}