Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
2b4acb6
1
Parent(s): cbb69a2
Fix stale approval dialog reappearing after page refresh
Browse filesThe message persist effect only triggered on message count changes,
so approval state updates (which modify tool state within existing
messages) were never saved to localStorage. On refresh, stale
approval-requested state was restored. Now saves messages immediately
after approval submission.
frontend/src/hooks/useAgentChat.ts
CHANGED
|
@@ -629,6 +629,11 @@ export function useAgentChat({ sessionId, isActive, onReady, onError, onSessionD
|
|
| 629 |
if (hasApproved) {
|
| 630 |
updateSession(sessionId, { isProcessing: true });
|
| 631 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 632 |
return true;
|
| 633 |
},
|
| 634 |
[sessionId, chat, updateSession, setNeedsAttention],
|
|
|
|
| 629 |
if (hasApproved) {
|
| 630 |
updateSession(sessionId, { isProcessing: true });
|
| 631 |
}
|
| 632 |
+
|
| 633 |
+
// Persist updated tool states so a page refresh during execution
|
| 634 |
+
// won't restore stale approval-requested state from localStorage.
|
| 635 |
+
saveMessages(sessionId, chatActionsRef.current.messages);
|
| 636 |
+
|
| 637 |
return true;
|
| 638 |
},
|
| 639 |
[sessionId, chat, updateSession, setNeedsAttention],
|