mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
fix(chat): keep approval pending until messages update
This commit is contained in:
parent
0a9c2b910d
commit
43ba36b42d
1 changed files with 14 additions and 1 deletions
|
|
@ -184,6 +184,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
tryBeginPendingAction: tryBeginFollowUpSuggestionActionPending,
|
||||
clearPendingAction: clearFollowUpSuggestionActionPending,
|
||||
} = usePendingActionContract()
|
||||
const approvalPendingMessagesSnapshotRef = useRef<ClineMessage[] | null>(null)
|
||||
const everVisibleMessagesTsRef = useRef<LRUCache<number, boolean>>(
|
||||
new LRUCache({
|
||||
max: 100,
|
||||
|
|
@ -516,10 +517,18 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
|
||||
useEffect(() => {
|
||||
if (!isApprovalActionPending) {
|
||||
approvalPendingMessagesSnapshotRef.current = null
|
||||
return
|
||||
}
|
||||
|
||||
clearApprovalActionPending()
|
||||
if (approvalPendingMessagesSnapshotRef.current === null) {
|
||||
approvalPendingMessagesSnapshotRef.current = messages
|
||||
return
|
||||
}
|
||||
|
||||
if (messages !== approvalPendingMessagesSnapshotRef.current) {
|
||||
clearApprovalActionPending()
|
||||
}
|
||||
}, [messages, isApprovalActionPending, clearApprovalActionPending])
|
||||
|
||||
// Update button text when messages change (e.g., completion_result is added) for subtasks in resume_task state
|
||||
|
|
@ -923,6 +932,8 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
return
|
||||
}
|
||||
|
||||
approvalPendingMessagesSnapshotRef.current = messagesRef.current
|
||||
|
||||
// Apply optimistic pending UI immediately on click.
|
||||
beginActionResolutionTransition()
|
||||
|
||||
|
|
@ -974,6 +985,8 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
return
|
||||
}
|
||||
|
||||
approvalPendingMessagesSnapshotRef.current = messagesRef.current
|
||||
|
||||
// Apply optimistic pending UI immediately on click to avoid stale controls.
|
||||
beginActionResolutionTransition()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue