Skip to content

fix(chat): eliminate conversation switch flicker - #390

Open
AprilNEA wants to merge 1 commit into
masterfrom
xuan/code-259
Open

fix(chat): eliminate conversation switch flicker#390
AprilNEA wants to merge 1 commit into
masterfrom
xuan/code-259

Conversation

@AprilNEA

@AprilNEA AprilNEA commented Aug 1, 2026

Copy link
Copy Markdown
Member

What changed

  • render the newly selected conversation from the live selection instead of deferring the outgoing conversation
  • keep virtua's external-scroll offset synchronized while row measurements settle before the first paint
  • extend the Chromium smoke flow to assert that the first rendered update already shows the selected title, the latest turn, and a bottom gap within 2 px

Root cause

The session surface still derived its active conversation from useDeferredValue(selectedId). That deferral was introduced with the old View Transition path, but remained after View Transitions were removed, so a click intentionally committed one more frame of the outgoing conversation.

After that stale frame was removed, the existing synchronous DOM snap exposed a second timing gap: virtua tracks an external scroller from scroll events. As measured row heights settled, the DOM reached the bottom before the virtualizer learned the new offset, leaving the first paint about 9.75 px above the tail.

Impact

Switching conversations now paints the selected conversation directly at its latest message. The optional smooth-follow setting from #385 remains unchanged for users who explicitly enable it.

Verification

  • pnpm check:ci
  • pnpm test — 302 files passed, 3 skipped; 2,435 tests passed, 5 skipped
  • pnpm -F @linkcode/webview e2e:browser
  • mutation check: restoring useDeferredValue fails with First paint still showed "Wire the workbench to the daemon"
  • timing check: omitting the virtualizer scroll notification fails with a 9.75 px first-paint bottom gap

Tracks CODE-259.

@linear-code

linear-code Bot commented Aug 1, 2026

Copy link
Copy Markdown

CODE-259

@AprilNEA
AprilNEA marked this pull request as ready for review August 2, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant