Skip to content

Commit aea1d32

Browse files
committed
fix: flaky auto-approve
1 parent 25c21cb commit aea1d32

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/blink/src/react/use-dev-mode.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,6 @@ export default function useDevMode(options: UseDevModeOptions): UseDevMode {
532532
setAutoApprove(true);
533533
}
534534

535-
// Mark this message as handled immediately
536-
setApprovalHandled(needsApproval.id);
537-
538535
const messages = chat.messages;
539536
if (messages.length === 0) {
540537
return;
@@ -549,6 +546,8 @@ export default function useDevMode(options: UseDevModeOptions): UseDevMode {
549546
if (!Array.isArray(lastMsg.parts)) {
550547
return;
551548
}
549+
// Mark approval handled only if we can update the message
550+
setApprovalHandled(needsApproval.id);
552551
// Update all pending approval outputs
553552
const updatedParts = lastMsg.parts.map((part: any) => {
554553
if (

0 commit comments

Comments
 (0)