Skip to content

Commit 87044dd

Browse files
committed
fix: reset cancel button state when streaming ends or task changes
- Reset didClickCancel flag when streaming transitions from active to inactive - Reset didClickCancel flag when switching between tasks - Reset didClickCancel flag during chat reset operations - Fixes issue where cancel button remained inactive after clicking cancel Fixes #9303
1 parent 7a06902 commit 87044dd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
414414
everVisibleMessagesTsRef.current.clear() // Clear for new task
415415
setCurrentFollowUpTs(null) // Clear follow-up answered state for new task
416416
setIsCondensing(false) // Reset condensing state when switching tasks
417+
setDidClickCancel(false) // Reset cancel button state when switching tasks
417418
// Note: sendingDisabled is not reset here as it's managed by message effects
418419

419420
// Clear any pending auto-approval timeout from previous task
@@ -524,6 +525,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
524525
setSelectedImages([])
525526
setClineAsk(undefined)
526527
setEnableButtons(false)
528+
setDidClickCancel(false) // Reset cancel button state when chat resets
527529
// Do not reset mode here as it should persist.
528530
// setPrimaryButtonText(undefined)
529531
// setSecondaryButtonText(undefined)
@@ -961,6 +963,11 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
961963
}
962964
}
963965

966+
// Reset didClickCancel when streaming ends
967+
if (wasStreaming && !isStreaming) {
968+
setDidClickCancel(false)
969+
}
970+
964971
// Update previous value.
965972
setWasStreaming(isStreaming)
966973
}, [isStreaming, lastMessage, wasStreaming, messages.length])

0 commit comments

Comments
 (0)