We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b6c32e3 commit 0c95567Copy full SHA for 0c95567
src/components/ChatSection.tsx
@@ -26,12 +26,17 @@ const ChatSection = () => {
26
const [isLoading, setIsLoading] = useState(false);
27
const [isServerOnline, setIsServerOnline] = useState(true);
28
const messagesEndRef = useRef<HTMLDivElement>(null);
29
+ const isInitialLoad = useRef(true);
30
31
const scrollToBottom = () => {
32
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
33
};
34
35
useEffect(() => {
36
+ if (isInitialLoad.current) {
37
+ isInitialLoad.current = false;
38
+ return;
39
+ }
40
scrollToBottom();
41
}, [messages]);
42
0 commit comments