Defer clearing pending chat screenshots until send commits

This commit is contained in:
CREDO23 2026-04-24 20:58:39 +02:00
parent ba25c68c0d
commit 18108267d1

View file

@ -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()}`;