diff options
| author | Adam <[email protected]> | 2025-12-19 13:11:08 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-12-19 13:11:08 -0600 |
| commit | b19a424c85eb892600c49f1b45c9a8c09f6d07eb (patch) | |
| tree | 033f6b906fb99372c82d0a2cef607453153580e0 | |
| parent | 1689281c357e8e0785825dfe838a1bdafccb00c1 (diff) | |
| download | opencode-b19a424c85eb892600c49f1b45c9a8c09f6d07eb.tar.gz opencode-b19a424c85eb892600c49f1b45c9a8c09f6d07eb.zip | |
chore: cleanup
| -rw-r--r-- | packages/ui/src/components/message-part.tsx | 1 | ||||
| -rw-r--r-- | packages/ui/src/components/session-turn.tsx | 20 |
2 files changed, 3 insertions, 18 deletions
diff --git a/packages/ui/src/components/message-part.tsx b/packages/ui/src/components/message-part.tsx index 2fa9cf474..0669f2ec1 100644 --- a/packages/ui/src/components/message-part.tsx +++ b/packages/ui/src/components/message-part.tsx @@ -502,7 +502,6 @@ ToolRegistry.register({ render(props) { const diffComponent = useDiffComponent() const diagnostics = createMemo(() => getDiagnostics(props.metadata.diagnostics, props.input.filePath)) - console.log(props) return ( <BasicTool {...props} diff --git a/packages/ui/src/components/session-turn.tsx b/packages/ui/src/components/session-turn.tsx index f101a3aa4..bd65ffdc1 100644 --- a/packages/ui/src/components/session-turn.tsx +++ b/packages/ui/src/components/session-turn.tsx @@ -271,7 +271,6 @@ export function SessionTurn( const scrollTop = scrollRef.scrollTop const scrollHeight = scrollRef.scrollHeight - // If we're in a reflow state (width just changed), don't interpret as user scroll if (store.reflowing) { batch(() => { setStore("lastScrollTop", scrollTop) @@ -280,19 +279,13 @@ export function SessionTurn( return } - // Check if this looks like a reflow-induced scroll adjustment - // When width changes, scrollHeight changes and browser adjusts scrollTop proportionally const scrollHeightChanged = Math.abs(scrollHeight - store.lastScrollHeight) > 10 const scrollTopDelta = scrollTop - store.lastScrollTop - // If scrollHeight decreased (content got shorter due to wider width), - // and scrollTop decreased proportionally, this is reflow, not user scroll if (scrollHeightChanged && scrollTopDelta < 0) { const heightRatio = store.lastScrollHeight > 0 ? scrollHeight / store.lastScrollHeight : 1 const expectedScrollTop = store.lastScrollTop * heightRatio - const tolerance = 100 // Allow some tolerance for the adjustment - if (Math.abs(scrollTop - expectedScrollTop) < tolerance) { - // This is a proportional adjustment from reflow, not user scrolling + if (Math.abs(scrollTop - expectedScrollTop) < 100) { batch(() => { setStore("lastScrollTop", scrollTop) setStore("lastScrollHeight", scrollHeight) @@ -311,7 +304,6 @@ export function SessionTurn( return } - // Only count as user scroll if scrollTop decreased without a corresponding scrollHeight change const scrolledUp = scrollTop < store.lastScrollTop - 50 && !scrollHeightChanged if (scrolledUp && working()) { setStore("userScrolled", true) @@ -346,28 +338,22 @@ export function SessionTurn( }) } - // Track width changes to detect reflow situations createResizeObserver( () => store.contentRef, ({ width }) => { const widthChanged = Math.abs(width - store.lastContainerWidth) > 5 if (widthChanged && store.lastContainerWidth > 0) { - // Width changed - mark as reflowing to ignore scroll adjustments setStore("reflowing", true) - // Clear reflow state after browser has had time to adjust requestAnimationFrame(() => { requestAnimationFrame(() => { setStore("reflowing", false) - // Restore auto-scroll if we're still working if (working() && !store.userScrolled) { scrollToBottom() } }) }) - } else { - if (!store.reflowing) { - scrollToBottom() - } + } else if (!store.reflowing) { + scrollToBottom() } setStore("lastContainerWidth", width) }, |
