agent ui: reset cancel-turn busy state via .finally(), not a thinking-flip effect
argus (PR review): the thinking-flip useEffect left the button stuck
disabled if the /api/cancel POST itself failed while the turn was
still genuinely thinking, since nothing re-fires the effect. Switch
onCancelTurn's signature to () => Promise<void> and reset cancelBusy
in a .finally() on that promise instead — fires on success or
failure alike, matching app.js's original
postCancelTurn().finally(() => { btn.disabled = false; }).
This commit is contained in:
parent
b753ec2093
commit
49c3b86dfd
2 changed files with 14 additions and 14 deletions
|
|
@ -155,7 +155,7 @@ export function Root() {
|
|||
paused={false}
|
||||
onTogglePause={() => {}}
|
||||
thinking={false}
|
||||
onCancelTurn={() => {}}
|
||||
onCancelTurn={() => Promise.resolve()}
|
||||
/>
|
||||
</Header>
|
||||
<main className="agent-main">
|
||||
|
|
@ -210,12 +210,12 @@ export function Root() {
|
|||
);
|
||||
}}
|
||||
thinking={effectiveTurnState === 'thinking'}
|
||||
onCancelTurn={() => {
|
||||
onCancelTurn={() =>
|
||||
postCancelTurn().then((r) => {
|
||||
if (!r.ok) liveStreamRef.current?.pushNote(`✗ /cancel failed${r.detail ? ': ' + r.detail : ''}`);
|
||||
refresh();
|
||||
});
|
||||
}}
|
||||
})
|
||||
}
|
||||
/>
|
||||
</Header>
|
||||
<main className="agent-main">
|
||||
|
|
|
|||
Loading…
Reference in a new issue