We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae98c67 commit 949940eCopy full SHA for 949940e
apps/portal/src/components/AI/chat.tsx
@@ -134,17 +134,13 @@ export function Chat() {
134
);
135
136
useEffect(() => {
137
- const timer = setTimeout(() => {
138
- if (lastMessageRef.current) {
139
- lastMessageRef.current.scrollIntoView({
140
- behavior: "smooth",
141
- block: "end",
142
- });
143
- }
144
- }, 100);
145
-
146
- return () => clearTimeout(timer);
147
- }, []);
+ if (lastMessageRef.current && messages.length > 0) {
+ lastMessageRef.current.scrollIntoView({
+ behavior: "smooth",
+ block: "start",
+ });
+ }
+ }, [messages.length]);
148
149
const handleInputChange = (e: ChangeEvent<HTMLTextAreaElement>) => {
150
setInput(e.target.value);
0 commit comments