Skip to content

fix(components): stop sidebar resize chat jitter - #371

Merged
wibus-wee merged 1 commit into
mainfrom
fix/sidebar-conversation-jitter
Sep 4, 2026
Merged

fix(components): stop sidebar resize chat jitter#371
wibus-wee merged 1 commit into
mainfrom
fix/sidebar-conversation-jitter

Conversation

@wibus-wee

Copy link
Copy Markdown
Member

Related issue

Same-repository fix; no tracking issue was required for intake.

Problem / pressure

Opening or closing the desktop navigation sidebar animates the conversation viewport width. The sticky-scroll viewport observer treated every width-only ResizeObserver record as a reason to re-anchor Virtua at the bottom, competing with use-stick-to-bottom and making the conversation move vertically by a few pixels.

Summary

  • Ignore viewport ResizeObserver records when the viewport height did not change.
  • Preserve height-driven re-anchoring for keyboard, terminal dock, and window layout changes.
  • Add a regression test that emits several consecutive width-only resize records while the conversation remains sticky.
  • Record the adapter ownership boundary in the scoped hooks contributor guidance.

Before / after

Before After
Every sidebar animation frame could request a Virtua bottom re-anchor. Width-only sidebar animation frames leave the vertical scroll position untouched.
Viewport height changes kept a sticky conversation pinned to the bottom. Viewport height changes continue to keep a sticky conversation pinned to the bottom.

Test plan

  • pnpm exec vitest run tests/use-sticky-scroll.test.ts from packages/components: 7 tests passed.
  • pnpm typecheck from packages/components: passed.
  • pnpm exec prettier --check src/hooks/use-sticky-scroll.ts tests/use-sticky-scroll.test.ts src/hooks/AGENTS.md: passed.
  • git diff --check: passed.

Context handoff

Instructions for reviewing agents

  • Review focus: Check the height-only filter in use-sticky-scroll.ts and the repeated width-resize regression in use-sticky-scroll.test.ts.
  • Decisions to challenge: Confirm that content reflow remains owned by use-stick-to-bottom while the app adapter owns only viewport height re-anchoring.
  • Plausible failures / evidence gaps: A browser-level Electron interaction test was not run; evidence is the focused deterministic ResizeObserver test plus the existing height/content-growth cases.

Authoring context

  • User goal / directives: Remove the visible vertical conversation jitter when toggling the desktop sidebar and publish the fix as a PR.
  • Constraints / non-goals: Preserve sticky streaming, user escape behavior, composer suppression, session restoration, and keyboard or terminal height handling; do not redesign the sidebar animation.
  • Risk-bearing decisions: Width-only viewport changes are ignored by the Virtua adapter because content-height changes continue through the library's content observer.
  • Destructive or irreversible behavior: The change performs no data mutation, migration, deletion, or irreversible operation.
  • Deliberately not done or tested: Full Electron end-to-end interaction was omitted because the deterministic hook suite directly exercises the conflicting observer path.
  • Unknowns / confidence: Confidence is high for the reported path; platform-specific ResizeObserver scheduling remains covered indirectly rather than by a packaged-app test.

Ignore width-only viewport ResizeObserver records so the Virtua adapter does
not compete with the content bottom observer during sidebar animation. Keep
height-driven re-anchoring for keyboard and dock changes, and cover the
width-only path with a regression test.

Model: gpt-5.6-sol
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T03:03:19.987834Z b9730d1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@wibus-wee
wibus-wee merged commit 09d370d into main Sep 4, 2026
4 checks passed
@wibus-wee
wibus-wee deleted the fix/sidebar-conversation-jitter branch September 4, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant