Skip to content

Show agent tabs at once with loading skeletons - #48

Merged
srctl merged 1 commit into
mainfrom
claude/tab-skeletons
Nov 19, 2026
Merged

srctl merged 1 commit into
mainfrom
claude/tab-skeletons

Conversation

@srctl

@srctl srctl commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Requested by Scott · project thread

Why

Tab switches between Chat, Note and Dashboard are client-side, but TanStack Router keeps the previous page on screen until the destination's loader resolves (and only shows a pending component after defaultPendingMs, 1 s). So a click looked like nothing happened until the data came back. #47 hid that by preloading every tab in the background. The behaviour we want instead: switch immediately, start loading on click, and show a skeleton until the data arrives.

What changed

  • Chat, Note and Dashboard routes set pendingMs: 0, pendingMinMs: 0 and a pendingComponent, which TanStack Router renders as soon as the navigation starts while the loader runs.
  • Each pending component renders the real AgentHeader (so the segmented control is live right away) plus a skeleton in that tab's layout: chat bubbles and composer, note paper lines, and dashboard cards with the side chat.
  • New components/ui/skeleton.tsx (Skeleton, SkeletonGroup). Groups are role="status" with aria-busy, and fade in after 150 ms so quick loads don't flash. The pulse stops under reduced motion.
  • Removed Make agent tab switches render from cache #47's background preloading in AgentHeader and its 30-minute cache settings. Revisits within the router's default 5-minute cache still render cached data at once and revalidate in the background. Make agent tab switches render from cache #47's memoized conversation rows and note snapshot handling stay.

Deferred loader data (<Await>) was the other option. It broke route type inference for the conversation and dashboard snapshots, and it would re-suspend (and flash a skeleton) on every background revalidation. Pending components avoid both problems.

Measurements

Production build on the dev data copy. Headless Chrome with 300 ms of added network latency, first visit to each tab:

Before (pre-#47 main) After
Note: new page on screen ~515 ms (only when data arrives) ~80–110 ms (skeleton), content at ~440 ms
Dashboard: new page on screen ~690 ms ~65 ms (skeleton), content at ~420 ms

With 2 s of latency the skeleton still appears in 40–70 ms. That time is client work, not network.

Testing

  • pnpm test (429 pass), tsc --noEmit, biome check.
  • Browser check on the production build: skeletons render for all three tabs on a slow network, real content replaces them, no page errors.

🤖 Generated with Claude Code

Clicking Chat, Note or Dashboard kept the previous page on screen until
the destination's loader finished. Each tab route now shows its pending
component immediately (pendingMs 0) with a skeleton that matches its
layout, while the loader fetches in the background. Revisits still render
cached data at once and revalidate.

This replaces the background preloading from #47: data now loads on click,
as requested. Skeletons fade in after 150 ms so fast loads don't flash.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@srctl
srctl merged commit bf89497 into main Nov 19, 2026
2 checks passed
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