Skip to content

Commit b19a424

Browse files
committed
chore: cleanup
1 parent 1689281 commit b19a424

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

packages/ui/src/components/message-part.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@ ToolRegistry.register({
502502
render(props) {
503503
const diffComponent = useDiffComponent()
504504
const diagnostics = createMemo(() => getDiagnostics(props.metadata.diagnostics, props.input.filePath))
505-
console.log(props)
506505
return (
507506
<BasicTool
508507
{...props}

packages/ui/src/components/session-turn.tsx

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ export function SessionTurn(
271271
const scrollTop = scrollRef.scrollTop
272272
const scrollHeight = scrollRef.scrollHeight
273273

274-
// If we're in a reflow state (width just changed), don't interpret as user scroll
275274
if (store.reflowing) {
276275
batch(() => {
277276
setStore("lastScrollTop", scrollTop)
@@ -280,19 +279,13 @@ export function SessionTurn(
280279
return
281280
}
282281

283-
// Check if this looks like a reflow-induced scroll adjustment
284-
// When width changes, scrollHeight changes and browser adjusts scrollTop proportionally
285282
const scrollHeightChanged = Math.abs(scrollHeight - store.lastScrollHeight) > 10
286283
const scrollTopDelta = scrollTop - store.lastScrollTop
287284

288-
// If scrollHeight decreased (content got shorter due to wider width),
289-
// and scrollTop decreased proportionally, this is reflow, not user scroll
290285
if (scrollHeightChanged && scrollTopDelta < 0) {
291286
const heightRatio = store.lastScrollHeight > 0 ? scrollHeight / store.lastScrollHeight : 1
292287
const expectedScrollTop = store.lastScrollTop * heightRatio
293-
const tolerance = 100 // Allow some tolerance for the adjustment
294-
if (Math.abs(scrollTop - expectedScrollTop) < tolerance) {
295-
// This is a proportional adjustment from reflow, not user scrolling
288+
if (Math.abs(scrollTop - expectedScrollTop) < 100) {
296289
batch(() => {
297290
setStore("lastScrollTop", scrollTop)
298291
setStore("lastScrollHeight", scrollHeight)
@@ -311,7 +304,6 @@ export function SessionTurn(
311304
return
312305
}
313306

314-
// Only count as user scroll if scrollTop decreased without a corresponding scrollHeight change
315307
const scrolledUp = scrollTop < store.lastScrollTop - 50 && !scrollHeightChanged
316308
if (scrolledUp && working()) {
317309
setStore("userScrolled", true)
@@ -346,28 +338,22 @@ export function SessionTurn(
346338
})
347339
}
348340

349-
// Track width changes to detect reflow situations
350341
createResizeObserver(
351342
() => store.contentRef,
352343
({ width }) => {
353344
const widthChanged = Math.abs(width - store.lastContainerWidth) > 5
354345
if (widthChanged && store.lastContainerWidth > 0) {
355-
// Width changed - mark as reflowing to ignore scroll adjustments
356346
setStore("reflowing", true)
357-
// Clear reflow state after browser has had time to adjust
358347
requestAnimationFrame(() => {
359348
requestAnimationFrame(() => {
360349
setStore("reflowing", false)
361-
// Restore auto-scroll if we're still working
362350
if (working() && !store.userScrolled) {
363351
scrollToBottom()
364352
}
365353
})
366354
})
367-
} else {
368-
if (!store.reflowing) {
369-
scrollToBottom()
370-
}
355+
} else if (!store.reflowing) {
356+
scrollToBottom()
371357
}
372358
setStore("lastContainerWidth", width)
373359
},

0 commit comments

Comments
 (0)