Skip to content

Show one loading state per action across the timeline, panels, side chat, and palette - #5264

Merged
ymichael merged 8 commits into
mainfrom
bb/investigate-timeline-loading-states-thr_rddmadu3us
Oct 9, 2026
Merged

ymichael merged 8 commits into
mainfrom
bb/investigate-timeline-loading-states-thr_rddmadu3us

Conversation

@ymichael

@ymichael ymichael commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

One user action stepped through several different loading placeholders because every layer of a lazily loaded surface drew its own placeholder and only started its async work after the layer above it mounted. Expanding a settled edit row showed "Loading details..." (the deferred-content fetch from #5240), then the diff block chunk skeleton, then the card header with a viewport-gated skeleton, then the bb-diff chunk skeleton, then the Pierre worker pool skeleton, then a plain diff, then the highlighted diff. Opening a thread, a file preview, the diff panel, side chat, and the Cmd+K thread search had the same pattern. Some placeholders also showed wrong data while loading: the diff toolbar said "No changes", the info tab said "No thread details available.", and the side chat composer showed the provider's default model before the thread's own model.

What changed

Timeline rows (ThreadTimelineRows.tsx, timeline-row-body-preload.ts, ExpandableTimelineRow.tsx, disclosure.tsx):

  • Rows preload their body on hover (80 ms dwell), press, or focus: the deferred detail query (prefetchThreadTimelineTurnSummaryDetails), the renderer chunks, and the diff worker pool.
  • An expanded row body shows one bordered placeholder (TimelineRowBodyPlaceholder, fades in after 150 ms) until its content and renderers are ready. "Loading turn details..." and "Loading subagent activity..." are unchanged.
  • The worker pool gate (ThreadDetailWorkerPoolProvider) now waits for pool.initialize(); Pierre renders nothing before that.
  • The timeline diff card renders without waiting for an intersection callback (renderBeforeVisible).
  • defineSplit exposes isLoaded(); useRequirePierreWorkerPool(required) and useRequestPierreWorkerPool() added.

Thread open (route-loading-skeleton.tsx, ThreadTimelineLoadingSkeleton.tsx, ThreadTimelineSurface.tsx, App.tsx, LazyThreadDetailView.tsx, ThreadDetailView.tsx):

  • Thread route skeletons include the timeline skeleton, and the timeline shows its skeleton immediately when it replaces a route skeleton instead of going blank for 200 ms.
  • The info tab shows its metadata skeleton until the thread bootstrap settles.

File preview (FilePreviewChrome.tsx, lazySecondaryPanelComponents.tsx, ThreadStorageFilePreview.tsx):

  • Chunk fallbacks and the cold panel placeholder draw the same header and source skeleton as the loading preview. Preview tab chunks preload with the panel, and opening a preview starts the source renderer chunk and code workers alongside the file request.

Diff panel (ThreadSecondaryPanelTabContent.tsx, ThreadSecondaryPanel.tsx, GitDiffToolbar.tsx, GitDiffCardBody.tsx):

  • "Checking Git support…" and the file-list wait show the same skeleton cards, now shaped like the real cards. The toolbar shows a skeleton instead of "No changes" while files load. The automatic context prefetch no longer flashes "Expand context" / "Loading context…" (a user-requested expansion still shows it). The diff renderer chunk and workers start when the panel opens.

Code hosts (DiffHost.tsx, SourceCodeHost.tsx): the fallback prop is removed; both always show their own skeleton while the renderer chunk loads, so the plugin SDK Diff and SourceCode components show a skeleton instead of rendering nothing first.

Side chat (ThreadChatLoading.tsx, LazyPluginThreadChat.tsx, PluginThreadChat.tsx, PluginPanelActions.tsx, EmbeddedThreadChat.tsx):

  • The chat chunk fallback and the thread wait render the leading content (the "Replying to" anchor) with the same timeline skeleton the loaded chat uses.
  • Plugin panel tabs render nothing instead of "This plugin tab is not available…" until plugin frontends settle.
  • The composer shows the model picker's loading state until the thread's default execution options resolve. Sending was already blocked in that window, so this only removes the wrong label.
  • The timeline controller (useThreadTimelineController.ts) no longer puts an already-loaded empty timeline back into the loading state on background refetches; only a timeline with no data yet (first load, or the retry after a failed read from Handle transient mobile read failures #401) reports loading. New side chats are empty, so each refetch while the thread provisioned brought the skeleton back.
  • FollowUpPromptBox starts expanded when its editor will autofocus on mount (fine pointers), instead of mounting compact and animating open one frame later.
  • Short-lived status in empty chats: the working indicator on an empty timeline (ThreadTimelineSurface) and the embedded composer's "Provisioning thread..." placeholder (EmbeddedThreadChat) appear only once that state has lasted 1.5 s (useSustainedFlag). A new side chat used to flash "Provisioning thread..." then "Working..." for about a second. Timelines with rows still show the working indicator immediately.

Command palette (CommandPalette.tsx, ThreadSearchPalettePlaceholder.tsx): thread search preloads, and its fallback is the real search shell instead of a bare "Loading threads" line.

No server, daemon wire, CLI, or plugin SDK source changes; HOST_DAEMON_PROTOCOL_VERSION is untouched.

Remaining: diffs still render plain text before syntax colours arrive (Pierre's worker flow; changing it affects every diff surface), and the diff panel shows one ~24 ms frame where only the first card has mounted.

How you verified

  • pnpm exec turbo run typecheck lint test --filter='...[origin/main]': 14/14 tasks pass (@bb/app 5577 tests).
  • New tests, each failing before the change:
    • ThreadTimelineRows.deferred-details.test.tsx: pressing a collapsed deferred row starts its detail request before expansion.
    • ThreadDetailWorkerPoolProvider.test.tsx: consumers stay waiting until the pool's highlighter has initialized.
    • GitDiffToolbar.test.tsx: the summary does not say "No changes" while the file list is loading.
  • useThreadTimelineController.test.tsx: "still reports timelineLoading while refetching an empty timeline" now asserts the opposite (a loaded empty timeline stays out of the loading state while refetching); the Handle transient mobile read failures #401 error-retry test still passes unchanged.
  • useSustainedFlag.test.tsx: the flag turns on only after the full delay and restarts the delay each time it turns on again.
  • FollowUpPromptBox.test.tsx: the composer starts expanded on fine pointers and compact on coarse pointers; mobile tests now use a coarse pointer.
  • Updated tests for the changed placeholders: LazyTerminalOutputBlock, CodeHosts.cold-load, DiffFileCard, plugin-slot-mounts, ThreadSecondaryPanel.collapseControl.
  • Manual, on a pnpm start:worktree instance with a Claude Code fixture thread: recorded painted frames with CDP screencast at 300 ms network latency before and after, and screenshotted every new loading state by holding its request open. Time until content: edit row diff 2.4 s → 1.5 s, file preview 0.70 s → 0.37 s, diff panel 2.1 s → 0.4 s; thread open, side chat, and Cmd+K go from 2–4 visually different placeholders to one.

AGENT GENERATED

🤖 Generated with Claude Code

qa and others added 8 commits October 9, 2026 11:03
Expanding a settled edit row stepped through five placeholders: a
"Loading details..." line, the diff chunk skeleton, the card header with
a viewport-gated skeleton, the bb-diff chunk skeleton, and the worker
pool skeleton. Each async step only started after the previous layer
mounted, so they ran in series.

- Rows preload their body on hover (80 ms dwell), press, or focus: the
  deferred detail query, the renderer chunks, and the diff worker pool.
- The row body shows one shaped placeholder until its content and
  renderers are ready, fading in after 150 ms so fast loads show none.
- The diff worker gate now waits for the pool's highlighter to finish
  initializing; Pierre renders nothing before that.
- The timeline diff card renders without waiting for an intersection
  callback.
- Deferred subagent rows hold their output until child rows load
  instead of inserting rows above it.
- Thread route skeletons include the timeline skeleton, and the timeline
  shows its skeleton immediately when it replaces a route skeleton.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lette

- File preview: the lazy tab fallback now draws the same header and
  source skeleton as the loading preview, the preview tab chunks preload
  with the panel, and opening a preview starts the source renderer chunk
  and code workers in parallel with the file request.
- Diff panel: "Checking Git support" and the file-list wait show the same
  skeleton cards, which now match the real card shape; the toolbar shows
  a skeleton instead of "No changes" while files load; automatic context
  prefetch no longer shows "Expand context" / "Loading context"; the diff
  renderer chunk and workers start when the panel opens.
- DiffHost and SourceCodeHost always use their own skeleton while the
  renderer chunk loads, so plugin diffs and source no longer go blank
  first.
- Side chat: the chat chunk fallback and the thread wait render the
  reply anchor with the same timeline skeleton; plugin tabs render
  nothing instead of "not available" until plugin frontends settle; the
  composer shows the model picker loading state until the thread's
  defaults resolve instead of the catalog default.
- Command palette: thread search preloads and its fallback is the real
  search shell instead of a bare "Loading threads" line.
- Thread info: the panel placeholder shows the info content directly
  when the info tab is active.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The cold panel placeholder shows the file preview loading shell when a
  file tab is active, instead of a generic skeleton.
- The info tab shows its metadata skeleton until the thread bootstrap
  settles, instead of "No thread details available."

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- An empty timeline that has already loaded no longer re-enters the
  loading state on background refetches; only a timeline with no data
  yet (first load, or a retry after a failed read) reports loading. New
  side chats are empty, so every refetch after provisioning brought the
  timeline skeleton back.
- FollowUpPromptBox starts expanded when its editor will autofocus on
  mount (fine pointers) instead of mounting compact and animating open a
  frame later.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A new side chat flashed "Provisioning thread..." and then "Working..."
in its empty timeline and composer placeholder for about a second while
the thread started. The working indicator on an empty timeline and the
embedded composer's provisioning placeholder now appear only once that
state has lasted 1.5 s (useSustainedFlag). Timelines with rows still
show the working indicator immediately.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- BbDiffSplit moves to its own module. The timeline row preload imported
  it from DiffHost, which pulled DiffHost and its patch helpers into the
  ThreadPage closure past the raw bundle budget.
- The thread search palette placeholder is built from PaletteInputBand
  instead of PaletteShell, which is a protected split boundary that must
  stay out of the boot payload.
- Drop the duplicate react-query import that main's version of
  markdown-message-directives.test.tsx already has.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/investigate-timeline-loading-states-thr_rddmadu3us branch from c4b01a7 to 0bb6db0 Compare October 9, 2026 18:11
@ymichael
ymichael merged commit 8761f26 into main Oct 9, 2026
28 checks passed
@ymichael
ymichael deleted the bb/investigate-timeline-loading-states-thr_rddmadu3us branch October 9, 2026 18:15
SawyerHood added a commit that referenced this pull request Oct 9, 2026
## Human comments

## What was wrong

When a provider install failed in the first-run setup guide, the agent
row said "Install failed. Check the log, then retry." but the row had no
way to open that log. The only route to it was the "View log" action on
the failure toast, which disappears.

## What changed

- `apps/app/src/components/onboarding/OnboardingViews.tsx`: a failed
install row now shows a **View log** button next to **Retry**. It also
shows when the machine reports no install action, so the log stays
reachable without a retry.
- `apps/app/src/components/onboarding/OnboardingFlow.tsx`: the button
opens the failure's stored log in the existing provider CLI install log
dialog, the same one the Updates settings page and the failure toast
use. The row text is shortened to "Install failed", since the buttons
now carry the rest and the longer text was truncated.
- `apps/app/src/components/onboarding/Onboarding.stories.tsx`: the
failed-install story passes the new handler and the shorter text.

-
`apps/app/src/components/secondary-panel/lazySecondaryPanelComponents.tsx`:
unrelated fix for a type error on `main` that failed this PR's lint and
typecheck job. The attachment preview tab (#5098) passed the shared
loading component directly, but that component requires a copy path
(#5264) the tab never supplies. The loading state now shows the
attachment name with no copy path, matching the loaded preview.

No wire, CLI, or configuration changes.

## How you verified

- Added `apps/app/src/components/onboarding/OnboardingViews.test.tsx`:
the log button appears only on the agent whose install failed and
reports that agent, and it stays available when no retry is offered.
- `pnpm exec turbo run test --filter=@bb/app --
src/components/onboarding src/components/secondary-panel` (565 tests
pass).
- `pnpm exec turbo run typecheck lint --filter=@bb/app` (0 errors; it
fails on `main` without the loading-state fix).
- Not checked in the running app.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Code <[email protected]>
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