diff --git a/surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx b/surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx index fe23cb2c7..da134c4cf 100644 --- a/surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx +++ b/surfsense_web/app/dashboard/[search_space_id]/new-chat/[[...chat_id]]/page.tsx @@ -499,7 +499,6 @@ export default function NewChatPage() { } const urlsSnapshot = [...pendingUserImageUrls]; - setPendingUserImageUrls([]); const { userQuery, userImages } = extractUserTurnForNewChatApi(message, urlsSnapshot); if (!userQuery.trim() && userImages.length === 0) return; @@ -544,6 +543,10 @@ export default function NewChatPage() { } } + if (urlsSnapshot.length > 0) { + setPendingUserImageUrls((prev) => prev.filter((u) => !urlsSnapshot.includes(u))); + } + // Add user message to state const userMsgId = `msg-user-${Date.now()}`;