Update Conversation.tsx

This commit is contained in:
Alex
2023-10-01 21:57:12 +01:00
parent 153b5c028b
commit af0e6481f8

View File

@@ -23,7 +23,7 @@ export default function Conversation() {
const endMessageRef = useRef<HTMLDivElement>(null);
const inputRef = useRef<HTMLDivElement>(null);
const [hasScrolledToLast, setHasScrolledToLast] = useState(false);
const [hasScrolledToLast, setHasScrolledToLast] = useState(true);
useEffect(() => {
scrollIntoView();
@@ -51,7 +51,7 @@ export default function Conversation() {
return () => {
observer.disconnect();
};
}, []);
}, [endMessageRef.current]);
const scrollIntoView = () => {
endMessageRef?.current?.scrollIntoView({