Skip to content

Commit cb970bc

Browse files
fix scroll not scrolling all the way
1 parent e16a995 commit cb970bc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/client/components/ChatV2/ChatV2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export const ChatV2 = () => {
140140
chatScroll.autoScroll()
141141
},
142142
onText: () => {
143-
// chatScroll.autoScroll()
143+
chatScroll.autoScroll()
144144
},
145145
onError: (error) => {
146146
handleCompletionStreamError(error, fileName)

src/client/hooks/useChatScroll.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ export const useChatScroll = (appContainerRef, endOfConversationRef) => {
8383
}
8484

8585
const smoothScrollTo = (duration: number) => {
86+
if(!shouldScroll.current)
87+
{
88+
return
89+
}
90+
//should scroll but there might be another scroll frame going so first it should be cancelled
91+
cancelScroll() //<--- cleans up everything
92+
shouldScroll.current = true // makes sure the animation can run
93+
8694
scrollAnimationFrame.current = requestAnimationFrame(step)
8795
}
8896

0 commit comments

Comments
 (0)