Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ next-env.d.ts

#Notion_db
/Notion_DB

/.idea
6 changes: 4 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export default function Home() {
textAreaRef.current?.focus();
}, []);

useEffect(() => {
messageListRef.current?.scrollTo(0, messageListRef.current.scrollHeight);
}, [messages]);

//handle form submission
async function handleSubmit(e: any) {
e.preventDefault();
Expand Down Expand Up @@ -102,8 +106,6 @@ export default function Home() {

setLoading(false);

//scroll to bottom
messageListRef.current?.scrollTo(0, messageListRef.current.scrollHeight);
} catch (error) {
setLoading(false);
setError('An error occurred while fetching the data. Please try again.');
Expand Down