Memoize liveRunSlot to prevent defeating React.memo on CommentThread

The liveRunSlot JSX was constructed inline on every render, creating a
new object reference that defeated the React.memo wrapper on
CommentThread. Extract it into a top-level useMemo so the memo boundary
works as intended.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Devin FoleyandPaperclip committed 2026-04-06 17:34:21 -07:00
1 parent 2779701aba
commit d98df7a246
1 file changed
+14 -10
+14 -10
View File
@@ -588,6 +588,19 @@ export function IssueDetail() {
[activity],
);
const memoizedLiveRunSlot = useMemo(
() =>
hasLiveRuns ? (
<LiveRunWidget
issueId={issueId!}
companyId={issue?.companyId ?? ""}
liveRunsData={liveRuns ?? []}
activeRunData={activeRun ?? null}
/>
) : null,
[hasLiveRuns, issueId, issue?.companyId, liveRuns, activeRun],
);
const issueCostSummary = useMemo(() => {
let input = 0;
let output = 0;
@@ -1595,16 +1608,7 @@ export function IssueDetail() {
onAdd={handleCommentAdd}
imageUploadHandler={handleCommentImageUpload}
onAttachImage={handleCommentAttachImage}
liveRunSlot={
hasLiveRuns ? (
<LiveRunWidget
issueId={issueId!}
companyId={issue.companyId}
liveRunsData={liveRuns ?? []}
activeRunData={activeRun ?? null}
/>
) : null
}
liveRunSlot={memoizedLiveRunSlot}
/>
</TabsContent>