Skip to content

Commit

Permalink
Simplify [UI/UX] [Chat] [Front End] scrollDomToBottom
Browse files Browse the repository at this point in the history
- [+] refactor(chat.tsx): improve smooth scrolling behavior in useScrollToBottom function
  • Loading branch information
H0llyW00dzZ committed Feb 7, 2024
1 parent bfefb99 commit 2d7ae21
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/components/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,8 @@ function useScrollToBottom() {
function scrollDomToBottom() {
const dom = scrollRef.current;
if (dom) {
requestAnimationFrame(() => {
setAutoScroll(true);
dom.scrollTo(0, dom.scrollHeight);
});
// Improve Use smooth scrolling behavior
dom.scrollTo({ top: dom.scrollHeight, behavior: 'smooth' });
}
}

Expand Down

0 comments on commit 2d7ae21

Please sign in to comment.