MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / commitScrollState

Function commitScrollState

apps/web/components/codex-thread-messages.tsx:273–283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271 }
272
273 function commitScrollState() {
274 const distanceFromBottom = viewport.scrollHeight - viewport.scrollTop - viewport.clientHeight;
275 pinnedRef.current = distanceFromBottom < 48;
276 const roundedScrollTop = Math.round(viewport.scrollTop / 12) * 12;
277 setScrollTop((current) => (current === roundedScrollTop ? current : roundedScrollTop));
278 setViewportHeight((current) => (current === viewport.clientHeight ? current : viewport.clientHeight));
279 setShowJumpButton((current) => (current === !pinnedRef.current ? current : !pinnedRef.current));
280 if (pinnedRef.current) {
281 setHasQueuedNewerMessages((current) => (current ? false : current));
282 }
283 }
284
285 function updatePinnedState() {
286 if (scrollUpdateFrameRef.current !== null) {

Callers 2

updatePinnedStateFunction · 0.85
CodexThreadMessagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected