fix(newChatView): remove unnecessary dependencies in useEffect hooks to improve performance and prevent unnecessary re-renders
This commit is contained in:
parent
ff112cfd34
commit
6c36fcec18
1 changed files with 3 additions and 3 deletions
|
|
@ -57,17 +57,17 @@ export default function newChatView(): JSX.Element {
|
||||||
return { isSend: !is_ai, message, sender_name };
|
return { isSend: !is_ai, message, sender_name };
|
||||||
});
|
});
|
||||||
setChatHistory(chatMessages);
|
setChatHistory(chatMessages);
|
||||||
}, [flowPool, outputIds]);
|
}, [flowPool]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (messagesRef.current) {
|
if (messagesRef.current) {
|
||||||
messagesRef.current.scrollTop = messagesRef.current.scrollHeight;
|
messagesRef.current.scrollTop = messagesRef.current.scrollHeight;
|
||||||
}
|
}
|
||||||
}, [chatHistory]);
|
}, []);
|
||||||
|
|
||||||
async function sendAll(data: sendAllProps): Promise<void> {}
|
async function sendAll(data: sendAllProps): Promise<void> {}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (ref.current) ref.current.scrollIntoView({ behavior: "smooth" });
|
if (ref.current) ref.current.scrollIntoView({ behavior: "smooth" });
|
||||||
}, [chatHistory]);
|
}, []);
|
||||||
|
|
||||||
const ref = useRef<HTMLDivElement | null>(null);
|
const ref = useRef<HTMLDivElement | null>(null);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue