Skip to content

Commit

Permalink
refactor: new scroll logic by last user msg
Browse files Browse the repository at this point in the history
  • Loading branch information
nzambello committed Dec 24, 2024
1 parent 85ed96c commit bc469d3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/Chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ const Chat: React.FC<Props> = ({
}) => {
const scrollToBottom = () => {
setTimeout(() => {
document
.querySelector('.memori-chat--content')
?.scrollTo(
0,
document.querySelector('.memori-chat--content')?.scrollHeight ?? 0
);
let userMsgs = document.querySelectorAll(
'.memori-chat--bubble-container.memori-chat--bubble-from-user'
);
userMsgs[userMsgs.length - 1].scrollIntoView();
}, 200);
};
useEffect(() => {
Expand Down

0 comments on commit bc469d3

Please sign in to comment.