perf: wrap ToolCall, CodeBlock, ThinkingBlock, ImageBlock in React.memo
Prevents unnecessary re-renders of these frequently rendered child components when parent message list updates but individual props haven't changed.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import { useState, memo } from 'react';
|
||||
import { ChevronRight, ChevronDown, Brain } from 'lucide-react';
|
||||
import { useT } from '../hooks/useLocale';
|
||||
|
||||
export function ThinkingBlock({ text }: { text: string }) {
|
||||
export const ThinkingBlock = memo(function ThinkingBlock({ text }: { text: string }) {
|
||||
const t = useT();
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
@@ -25,4 +25,4 @@ export function ThinkingBlock({ text }: { text: string }) {
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user