Skip to content

fix(app): eliminate session switch latency — deferRender, Suspense flash, instant rendering#27912

Open
BYK wants to merge 3 commits into
anomalyco:devfrom
BYK:fix/session-switch-responsiveness
Open

fix(app): eliminate session switch latency — deferRender, Suspense flash, instant rendering#27912
BYK wants to merge 3 commits into
anomalyco:devfrom
BYK:fix/session-switch-responsiveness

Conversation

@BYK
Copy link
Copy Markdown
Contributor

@BYK BYK commented May 16, 2026

Issue for this PR

Closes #27910, closes #19793

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes three compounding session-switch responsiveness issues:

  1. Remove deferRender mechanism — eliminates the one-frame blank + 140ms setTimeout in session-composer-region that caused a ~170ms gap where the composer was invisible on every session switch. The composer now re-shows after a single rAF yield (~16ms).

  2. Remove sessionSync JSX read{sessionSync() ?? ""} was read in JSX, triggering the app-level <Suspense> boundary (splash screen) on every session switch. Since the resource returns void, the read is removed entirely — the fetcher still runs reactively from its source signal.

  3. Widen messagesReady gate — allow rendering when the session exists in the session list, even before messages have loaded. Shows a spinner in the timeline while messages load in the background, eliminating the blank screen on session switch.

How did you verify your code works?

Tested locally by rapidly switching between sessions in the web UI. Verified no blank flashes, no splash screen flicker, and the composer appears instantly. Messages load in the background with a spinner shown during loading.

Screenshots / recordings

N/A — performance/latency improvement.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

BYK added 3 commits May 16, 2026 17:47
…poser timeout

Remove the deferRender mechanism that blanked the review panel and
composer for one animation frame on every session switch. Remove the
140ms artificial setTimeout in session-composer-region that stacked on
top, causing a total ~170ms gap where the composer was invisible.
The composer now re-shows after a single rAF yield (~16ms).
The sessionSync createResource was read in JSX ({sessionSync() ?? ""}),
which triggered the nearest <Suspense> boundary (the app-level splash
screen) on every session switch while the sync Promise was pending.
Since the resource returns void (contributes nothing to the DOM), remove
the JSX read entirely — the fetcher still runs reactively from its
source signal regardless.
…session data

Widen the messagesReady gate to allow rendering when the session exists
in the session list, even before messages have loaded. This eliminates
the blank screen on session switch over slow connections. A spinner is
shown in the timeline while messages load in the background.
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.

Session switch causes ~170ms blank flash and Suspense splash screen Session navigation blocks UI when switching between large conversations

1 participant