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(chat): prevent duplicate image paste on windows (#5283)

Harsh Kumar895b7bf7b674
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/hooks/use-chat-attachments.ts b/apps/screenpipe-app-tauri/components/chat/standalone/hooks/use-chat-attachments.ts
index 54284417b..a469f55d0 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/hooks/use-chat-attachments.ts
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/hooks/use-chat-attachments.ts
@@ -276,7 +276,11 @@ export function useChatAttachments({
if (tryDispatch(item.getAsFile())) didDispatch = true;
}
}
- if (files && files.length > 0) {
+ // Only fall back to clipboard.files if items didn't yield anything.
+ // On Windows, both items and files contain the same image but as
+ // different File object references, so the handled-Set dedup fails
+ // and the image gets added twice.
+ if (!didDispatch && files && files.length > 0) {
for (let i = 0; i < files.length; i++) {
if (tryDispatch(files[i])) didDispatch = true;
}