Repository navigation
Make agent tab switches render from cache - #47
Merged
Merged
Conversation
Switching between Chat, Note and Dashboard waited on a server loader the first time each tab opened, and Chat/Dashboard then re-rendered every message about ten times while the conversation settled. - The agent header preloads its sibling tabs after mount, so a click or tap renders from the router cache and revalidates in the background. - Keep loader data for 30 minutes so long stays on one tab still switch from cache. - Memoize conversation rows with stable handlers, so polls and scroll bookkeeping no longer re-render unchanged messages. - The note editor keeps its first snapshot and refreshes once on mount, so cached or background-reloaded data can't re-trigger draft recovery. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
srctl
force-pushed
the
claude/fast-tab-switching
branch
from
November 19, 2026 18:58
662a9a2 to
ce6913b
Compare
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.
Requested by Scott · project thread
Why
Switching between an agent's Chat, Note and Dashboard tabs felt slow, almost like a server render. It's a client-side navigation, but:
Server time is not the problem: the loaders take 25–90 ms on the 4.5 GB dev database.
What changed
AgentHeaderpreloads its sibling tabs 250 ms after mount, so a click or tap renders from the router cache and revalidates in the background (works on touch, unlike hover prefetch).defaultGcTime,defaultPreloadGcTime) instead of 5.ConversationRowwith stablereact/openReplyhandlers, so unchanged messages skip re-rendering on polls and state updates.NoteWorkspacekeeps its first snapshot and refreshes once on mount, so cached or background-reloaded loader data can't re-trigger draft recovery and stale cached notes catch up immediately.Measurements
Production build of
mainvs this branch on the dev data copy (Shoppy, 60 rendered messages), headless Chrome, median of 4 switches.Testing
pnpm test(429 pass),tsc --noEmit,biome check.🤖 Generated with Claude Code