fix(json-chat): restore Chat-mode auto-scroll on streaming + send - #89
Merged
Conversation
PR #84 added the entriesHydrated gate to suppress the empty-state flash, but the gating made the entire ternary return null on a fresh chat mount (entries=[], !busy, entriesHydrated=false). The scroll container was left with no firstElementChild, so the useLayoutEffect that attaches the ResizeObserver — mounted once with empty deps — found nothing to observe and never re-ran after entries hydrated. From that point on streaming token deltas grew the content but never triggered the snap-to-bottom. Wrap the conditional in a stable min-h-full flex-col div so the RO always has a firstElementChild. The empty-state's previous min-h-full referenced the scroll container; with a wrapper in between, switch it to flex-1 so it fills the wrapper's column and the sparkle card stays centered. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Regression introduced in #84 (
1634f1d): Chat mode (json-mode) stopped auto-scrolling to the bottom — neither on streaming token deltas nor when the user sent a message.PR #84 added the
entriesHydratedgate to suppress the empty-state flash, but on a fresh chat mount (entries=[],!busy,entriesHydrated=false) the entire ternary returnsnull. That leaves the scroll container with nofirstElementChild, so theuseLayoutEffectthat attaches theResizeObserver— mounted once with empty deps — finds nothing to observe and never re-runs after entries hydrate. From that point on, streaming token deltas grow the content but never snap-to-bottom.Fix: wrap the conditional in a stable
min-h-full flex flex-coldiv so the RO always has afirstElementChildto attach to. The empty-state's previousmin-h-fullreferenced the scroll container; with the wrapper in between, switch it toflex-1so it fills the wrapper's column and the sparkle card stays centered.Test plan
npx electron-vite buildpassesnpx vitest runpasses (3 stale-out/failures are unrelated to this change — source tests green)🤖 Generated with Claude Code