fix: auto-send queue to check session status before sending (#447)

This commit is contained in:
Bohdan Triapitsyn
2026-02-19 11:55:42 +02:00
committed by GitHub
parent 34c8ff3962
commit 135b2c89be
2 changed files with 10 additions and 2 deletions
+10 -1
View File
@@ -666,9 +666,18 @@ export const ChatInput: React.FC<ChatInputProps> = ({ onOpenSettings, scrollToBo
// Prevent double-triggering
autoSendTriggeredRef.current = true;
const targetSessionId = currentSessionId;
// Use setTimeout to avoid calling during render
setTimeout(() => {
if (currentSessionId && currentProviderId && currentModelId) {
const activeSessionId = useSessionStore.getState().currentSessionId;
const currentStatus = targetSessionId
? useSessionStore.getState().sessionStatus?.get(targetSessionId)
: null;
const stillIdle = currentStatus?.type === 'idle';
const sessionUnchanged = Boolean(targetSessionId) && activeSessionId === targetSessionId;
if (sessionUnchanged && stillIdle && targetSessionId && currentProviderId && currentModelId) {
void handleSubmitRef.current({ queuedOnly: true });
}
autoSendTriggeredRef.current = false;
-1
View File
@@ -1382,7 +1382,6 @@ export const useEventStream = () => {
}
completeStreamingMessage(sessionId, messageId);
updateSessionStatus(sessionId, { type: 'idle' }, 'sse:message.updated.completed');
// Removed: void refreshSessionStatus();
const rawMessageSessionId = (message as { sessionID?: string }).sessionID;