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
This commit is contained in:
Roo Code 2025-11-17 14:43:39 +00:00
parent 7a06902dd8
commit 87044dde24

View file

@ -414,6 +414,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
everVisibleMessagesTsRef.current.clear() // Clear for new task
setCurrentFollowUpTs(null) // Clear follow-up answered state for new task
setIsCondensing(false) // Reset condensing state when switching tasks
setDidClickCancel(false) // Reset cancel button state when switching tasks
// Note: sendingDisabled is not reset here as it's managed by message effects
// Clear any pending auto-approval timeout from previous task
@ -524,6 +525,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
setSelectedImages([])
setClineAsk(undefined)
setEnableButtons(false)
setDidClickCancel(false) // Reset cancel button state when chat resets
// Do not reset mode here as it should persist.
// setPrimaryButtonText(undefined)
// setSecondaryButtonText(undefined)
@ -961,6 +963,11 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
}
}
// Reset didClickCancel when streaming ends
if (wasStreaming && !isStreaming) {
setDidClickCancel(false)
}
// Update previous value.
setWasStreaming(isStreaming)
}, [isStreaming, lastMessage, wasStreaming, messages.length])