mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 17:33:51 +02:00
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:
1 parent
2779701aba
commit
d98df7a246
1 file changed
+14
-10
@@ -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>
|
||||
|
||||
|
||||
Reference in new issue
Block a user