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

fix duplicate chat creation

Rudra Bhaskar96e42c31f31e
diff --git a/apps/screenpipe-app-tauri/lib/chat-utils.test.ts b/apps/screenpipe-app-tauri/lib/chat-utils.test.ts
index 3e650118c..60e148893 100644
--- a/apps/screenpipe-app-tauri/lib/chat-utils.test.ts
+++ b/apps/screenpipe-app-tauri/lib/chat-utils.test.ts
@@ -87,13 +87,19 @@ describe("chat-utils", () => {
expect(showWindowMock).not.toHaveBeenCalled();
});
- it("handles untargeted and same-window chat-load-conversation payloads for chat", () => {
+ it("keeps untargeted chat-load-conversation payloads on Home only", () => {
expect(
shouldHandleChatLoadConversationForWindow(
{ conversationId: "chat-1" },
- "chat",
+ "home",
)
).toBe(true);
+ expect(
+ shouldHandleChatLoadConversationForWindow(
+ { conversationId: "chat-1" },
+ "chat",
+ )
+ ).toBe(false);
expect(
shouldHandleChatLoadConversationForWindow(
{ conversationId: "chat-1", targetWindow: "chat" },
diff --git a/apps/screenpipe-app-tauri/lib/chat-utils.ts b/apps/screenpipe-app-tauri/lib/chat-utils.ts
index f2ca45148..0d179f27c 100644
--- a/apps/screenpipe-app-tauri/lib/chat-utils.ts
+++ b/apps/screenpipe-app-tauri/lib/chat-utils.ts
@@ -146,7 +146,7 @@ export function shouldHandleChatLoadConversationForWindow(
payload: ChatLoadConversationPayload | null | undefined,
windowLabel: ChatTargetWindow,
): boolean {
- return !payload?.targetWindow || payload.targetWindow === windowLabel;
+ return (payload?.targetWindow ?? "home") === windowLabel;
}
export function shouldActivateHomeSectionForChatLoadConversation(