Skip to content

Commit f4c994b

Browse files
committed
fix: SolidJS updates DOM synchronously, so we can measure and adjust immediately
1 parent 140ee9d commit f4c994b

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/cli/tui/routes/workflow/components/output/output-window.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,13 @@ export function OutputWindow(props: OutputWindowProps) {
115115
const linesLoaded = props.onLoadMore()
116116
debug('[OutputWindow] Lines loaded: %d', linesLoaded)
117117
if (linesLoaded > 0) {
118-
// Defer scroll adjustment until after render to get accurate measurements
119-
queueMicrotask(() => {
120-
const scrollHeightAfter = ref.scrollHeight
121-
const heightAdded = scrollHeightAfter - scrollHeightBefore
122-
// Maintain view position with small slack (5 lines) to prevent immediate re-trigger
123-
const slack = 5
124-
ref.scrollTop = scrollTop + heightAdded + slack
125-
debug('[OutputWindow] Scroll adjusted: heightAdded=%d, slack=%d, newScrollTop=%d', heightAdded, slack, ref.scrollTop)
126-
})
118+
// SolidJS updates DOM synchronously, so we can measure and adjust immediately
119+
const scrollHeightAfter = ref.scrollHeight
120+
const heightAdded = scrollHeightAfter - scrollHeightBefore
121+
// Maintain view position with small slack to prevent immediate re-trigger
122+
const slack = 5
123+
ref.scrollTop = scrollTop + heightAdded + slack
124+
debug('[OutputWindow] Scroll adjusted: heightAdded=%d, slack=%d, newScrollTop=%d', heightAdded, slack, ref.scrollTop)
127125
}
128126
}
129127
}

0 commit comments

Comments
 (0)