diff --git a/ui/src/components/CommentThread.tsx b/ui/src/components/CommentThread.tsx index 4d2bdc87111..020b2c2cdb6 100644 --- a/ui/src/components/CommentThread.tsx +++ b/ui/src/components/CommentThread.tsx @@ -1,4 +1,4 @@ -import { memo, useEffect, useMemo, useRef, useState, type ChangeEvent } from "react"; +import { memo, useCallback, useEffect, useMemo, useRef, useState, type ChangeEvent } from "react"; import { Link, useLocation } from "react-router-dom"; import type { Agent, @@ -728,26 +728,27 @@ export const CommentThread = memo(function CommentThread({ } } - async function handleFeedbackVote( - commentId: string, - vote: FeedbackVoteValue, - options?: { allowSharing?: boolean; reason?: string }, - ) { - if (!onVote) return; - setVotingTargetId(commentId); - try { - await onVote(commentId, vote, options); - } finally { - setVotingTargetId(null); - } - } + const handleFeedbackVote = useCallback( + async ( + commentId: string, + vote: FeedbackVoteValue, + options?: { allowSharing?: boolean; reason?: string }, + ) => { + if (!onVote) return; + setVotingTargetId(commentId); + try { + await onVote(commentId, vote, options); + } finally { + setVotingTargetId(null); + } + }, + [onVote], + ); const canSubmit = !submitting && !!body.trim(); - return ( -
-

Timeline ({timeline.length + queuedComments.length})

- + const timelineSection = useMemo( + () => ( + ), + [ + timeline, agentMap, currentUserId, companyId, projectId, + feedbackVoteByTargetId, feedbackDataSharingPreference, + onVote, handleFeedbackVote, votingTargetId, highlightCommentId, + feedbackTermsUrl, + ], + ); + + return ( +
+

Timeline ({timeline.length + queuedComments.length})

+ + {timelineSection} {liveRunSlot}