Skip to content

Commit 69c211c

Browse files
fix(vscode-webui): prevent unnecessary notification after new task submit (#711)
This change fixes a bug where unnecessary notifications were sent after submitting a new task. The autoApproveGuard was being set in the wrong order, causing potential race conditions that could trigger notifications when they shouldn't occur. The fix repositions the autoApproveGuard assignment to ensure it's set before calling sendMessage, preventing the unwanted notifications. 🤖 Generated with [Pochi](https://getpochi.com) Co-authored-by: Pochi <[email protected]>
1 parent 242f4b7 commit 69c211c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/vscode-webui/src/features/chat/hooks/use-chat-submit.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,22 @@ export function useChatSubmit({
136136
const parts = prepareMessageParts(t, text, uploadedAttachments);
137137
logger.debug("Sending message with files");
138138

139+
autoApproveGuard.current = "auto";
139140
await sendMessage({
140141
parts,
141142
});
142-
143-
autoApproveGuard.current = "auto";
144143
} catch (error) {
145144
// Error is already handled by the hook
146145
return;
147146
}
148147
} else if (allMessages.length > 0) {
149148
clearUploadError();
150149
const parts = prepareMessageParts(t, text, []);
150+
151+
autoApproveGuard.current = "auto";
151152
await sendMessage({
152153
parts,
153154
});
154-
autoApproveGuard.current = "auto";
155155
}
156156
},
157157
[

0 commit comments

Comments
 (0)