Skip to content

Commit 3f6c813

Browse files
committed
fix(file-viewer): re-engage auto-scroll when user scrolls back to bottom
1 parent 77f6364 commit 3f6c813

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

apps/sim/hooks/use-scroll-anchor.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ export function useScrollAnchor(isStreaming: boolean, content?: string) {
5757

5858
if (hasUserScrolledRef.current) {
5959
intendedScrollTopRef.current = el.scrollTop
60+
const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight
61+
if (distanceFromBottom <= NEAR_BOTTOM_THRESHOLD) {
62+
hasUserScrolledRef.current = false
63+
stickyRef.current = true
64+
}
6065
return
6166
}
6267

0 commit comments

Comments
 (0)