Skip to content

Commit

Permalink
🧹 fix: scroll bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Jan 1, 2024
2 parents 69a796f + a754220 commit 260b968
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions apps/medium/src/components/modules/chat/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ export default function Chat() {
const [conversationId] = useConversationId()

useLayoutEffect(() => {
setTimeout(() => {
window.scrollTo(0, document.body.scrollHeight)
// 120 fps
}, 8)
requestAnimationFrame(() => {
window.scrollTo(
0,
document.getElementsByClassName('page')[0]?.clientHeight ??
document.body.clientHeight
)
})
}, [chats.length])

if (isCharacterLoading)
Expand Down

0 comments on commit 260b968

Please sign in to comment.