MCPcopy Create free account
hub / github.com/anomalyco/opencode / scrollToBottom

Function scrollToBottom

packages/ui/src/hooks/create-auto-scroll.tsx:79–98  ·  view source on GitHub ↗
(force: boolean)

Source from the content-addressed store, hash-verified

77 }
78
79 const scrollToBottom = (force: boolean) => {
80 if (!force && !active()) return
81
82 if (force && store.userScrolled) setStore("userScrolled", false)
83
84 const el = store.scrollRef
85 if (!el) return
86
87 if (!force && store.userScrolled) return
88
89 const distance = distanceFromBottom(el)
90 if (distance < 2) {
91 markAuto(el)
92 return
93 }
94
95 // For auto-following content we prefer immediate updates to avoid
96 // visible "catch up" animations while content is still settling.
97 scrollToBottomNow("auto")
98 }
99
100 const stop = () => {
101 const el = store.scrollRef

Callers 2

handleScrollFunction · 0.70
createAutoScrollFunction · 0.70

Calls 5

setStoreFunction · 0.85
distanceFromBottomFunction · 0.85
markAutoFunction · 0.85
scrollToBottomNowFunction · 0.85
activeFunction · 0.70

Tested by

no test coverage detected