Skip to content

Commit 2233ae9

Browse files
committed
fix(chat): stabilize rehydration scroll-to-bottom convergence
1 parent 6ef149d commit 2233ae9

4 files changed

Lines changed: 1285 additions & 19 deletions

File tree

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,12 @@ const ChatRow = memo(
143143
)
144144

145145
useEffect(() => {
146+
const isHeightValid = height !== 0 && height !== Infinity
146147
// used for partials, command output, etc.
147148
// NOTE: it's important we don't distinguish between partial or complete here since our scroll effects in chatview need to handle height change during partial -> complete
148149
const isInitialRender = prevHeightRef.current === 0 // prevents scrolling when new element is added since we already scroll for that
149150
// height starts off at Infinity
150-
if (isLast && height !== 0 && height !== Infinity && height !== prevHeightRef.current) {
151+
if (isLast && isHeightValid && height !== prevHeightRef.current) {
151152
if (!isInitialRender) {
152153
onHeightChange(height > prevHeightRef.current)
153154
}

0 commit comments

Comments
 (0)