From edfa67253238e35ff24b86e2d006e6e6e1bc9a27 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Mon, 13 Jul 2026 15:45:22 -0700 Subject: [PATCH] Fix reply cancellation clearing the wrong comment's reply box When multiple comment threads had reply boxes open, cancelling one reply cleared replyingCommentId unconditionally, closing whichever box was open instead of the one actually cancelled. onCancelReply now threads through the specific commentId so cancellation only clears state if it matches the currently open reply. --- .../right-sidebar/checks-panel-content.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/components/right-sidebar/checks-panel-content.tsx b/src/renderer/src/components/right-sidebar/checks-panel-content.tsx index 0ffc41dd686..84798c944f8 100644 --- a/src/renderer/src/components/right-sidebar/checks-panel-content.tsx +++ b/src/renderer/src/components/right-sidebar/checks-panel-content.tsx @@ -1980,7 +1980,7 @@ function PRCommentGroupView({ presentation: PRCommentPresentationClasses onResolve?: (threadId: string, resolve: boolean) => boolean | Promise onStartReply?: (commentId: number) => void - onCancelReply?: () => void + onCancelReply?: (commentId: number) => void onReply?: (comment: PRComment, body: string) => Promise onEditComment?: (comment: PRComment, body: string) => Promise onDeleteComment?: (comment: PRComment) => void | Promise @@ -2001,7 +2001,7 @@ function PRCommentGroupView({ autoFocus disabled={replyDisabled} disabledReason={replyDisabledReason} - onCancel={onCancelReply} + onCancel={() => onCancelReply?.(comment.id)} onSubmit={(body) => onReply(comment, body)} /> @@ -2113,7 +2113,7 @@ function ResolvedCommentGroupsSection({ presentation: PRCommentPresentationClasses onResolve?: (threadId: string, resolve: boolean) => boolean | Promise onStartReply?: (commentId: number) => void - onCancelReply?: () => void + onCancelReply?: (commentId: number) => void onReply?: (comment: PRComment, body: string) => Promise onEditComment?: (comment: PRComment, body: string) => Promise onDeleteComment?: (comment: PRComment) => void | Promise @@ -2351,7 +2351,9 @@ export function PRCommentsList({ presentation={presentation} onResolve={onResolve} onStartReply={setReplyingCommentId} - onCancelReply={() => setReplyingCommentId(null)} + onCancelReply={(commentId) => + setReplyingCommentId((current) => (current === commentId ? null : current)) + } onReply={onReply} onEditComment={onEditComment} onDeleteComment={onDeleteComment} @@ -2679,7 +2681,9 @@ export function PRCommentsList({ presentation={presentation} onResolve={onResolve} onStartReply={setReplyingCommentId} - onCancelReply={() => setReplyingCommentId(null)} + onCancelReply={(commentId) => + setReplyingCommentId((current) => (current === commentId ? null : current)) + } onReply={onReply} onEditComment={onEditComment} onDeleteComment={onDeleteComment}