Skip to content

Commit 6041576

Browse files
committed
perf: memoize messages rendering
1 parent f0fdb9f commit 6041576

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/components/Messages.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, useState } from "react";
1+
import { memo, useEffect, useRef, useState } from "react";
22
import type { ConversationItem } from "../types";
33
import { Markdown } from "./Markdown";
44
import { DiffBlock } from "./DiffBlock";
@@ -198,7 +198,7 @@ function scrollKeyForItems(items: ConversationItem[]) {
198198
}
199199
}
200200

201-
export function Messages({
201+
export const Messages = memo(function Messages({
202202
items,
203203
isThinking,
204204
processingStartedAt = null,
@@ -531,4 +531,4 @@ export function Messages({
531531
<div ref={bottomRef} />
532532
</div>
533533
);
534-
}
534+
});

0 commit comments

Comments
 (0)