fix: suggest comment reassignment from recent commenter

This commit is contained in:
dotta
2026-03-20 06:05:05 -05:00
parent ee85028534
commit 4ffa2b15dc
4 changed files with 71 additions and 20 deletions

View File

@@ -46,6 +46,7 @@ interface CommentThreadProps {
enableReassign?: boolean;
reassignOptions?: InlineEntityOption[];
currentAssigneeValue?: string;
suggestedAssigneeValue?: string;
mentions?: MentionOption[];
}
@@ -269,13 +270,15 @@ export function CommentThread({
enableReassign = false,
reassignOptions = [],
currentAssigneeValue = "",
suggestedAssigneeValue,
mentions: providedMentions,
}: CommentThreadProps) {
const [body, setBody] = useState("");
const [reopen, setReopen] = useState(true);
const [submitting, setSubmitting] = useState(false);
const [attaching, setAttaching] = useState(false);
const [reassignTarget, setReassignTarget] = useState(currentAssigneeValue);
const effectiveSuggestedAssigneeValue = suggestedAssigneeValue ?? currentAssigneeValue;
const [reassignTarget, setReassignTarget] = useState(effectiveSuggestedAssigneeValue);
const [highlightCommentId, setHighlightCommentId] = useState<string | null>(null);
const editorRef = useRef<MarkdownEditorRef>(null);
const attachInputRef = useRef<HTMLInputElement | null>(null);
@@ -337,8 +340,8 @@ export function CommentThread({
}, []);
useEffect(() => {
setReassignTarget(currentAssigneeValue);
}, [currentAssigneeValue]);
setReassignTarget(effectiveSuggestedAssigneeValue);
}, [effectiveSuggestedAssigneeValue]);
// Scroll to comment when URL hash matches #comment-{id}
useEffect(() => {
@@ -370,7 +373,7 @@ export function CommentThread({
setBody("");
if (draftKey) clearDraft(draftKey);
setReopen(false);
setReassignTarget(currentAssigneeValue);
setReassignTarget(effectiveSuggestedAssigneeValue);
} finally {
setSubmitting(false);
}