Skip to content

Read cached thread in AppLayout while bootstrap is in flight - #10

Merged
Guitaraholic merged 1 commit into
mainfrom
fix/layout-thread-title-from-cache
Sep 2, 2026
Merged

Read cached thread in AppLayout while bootstrap is in flight#10
Guitaraholic merged 1 commit into
mainfrom
fix/layout-thread-title-from-cache

Conversation

@Guitaraholic

Copy link
Copy Markdown

Human comments

What was wrong

Datahazed/bb#6 lets ThreadDetailView read threadQueryKey while bootstrap is in flight. AppLayout still disabled useThread until GET /threads/:id?include=environment,host settled. After send (or any cached open), document.title stayed Thread <id prefix> and the favicon attention dot could not see the thread until that GET returned.

Same cache, second caller. Web and desktop (apps/app).

Related: get-bb/bb#1303.

What changed

  • useThread accepts bootstrap and applies resolveThreadDetailQueryMount internally (it already has the QueryClient).
  • ThreadDetailView and AppLayout (when the route is a thread) pass that snapshot. Non-thread routes keep refetchOnMount: "always".
  • AppLayout tests still mock useThread; they do not need a QueryClient.

Stacked on #6. No protocol bump.

Why this way

The helper already existed. The remaining wait was the other useThread call site. Putting the policy inside useThread is the one place both the pane and the shell go through, without adding useQueryClient to AppLayout (that would break layout tests that have no provider).

We did not unify compose+thread, and we did not start useEnvironment before bootstrap (that would duplicate the include GET).

Benefit to bb

Web and desktop. After create or a cached open, the window title and favicon badge match the thread immediately instead of waiting on bootstrap. Same product rule as #6: do not refuse cache we already wrote.

Harvest

Submit after #6 (this branch is stacked on it). Independent of #7/#8. Copy this body.

Decision record: Datahazed/bb#9.

How you verified

The existing phase-order test still records thread-chrome-ready before bootstrap-settled, now via useThread({ bootstrap }) — the same path AppLayout uses.

  • apps/app/src/hooks/queries/thread-queries.test.tsx 24 passed.
  • AppLayout.plugin-panel-header.test.tsx, AppLayout.root-compose-project.test.tsx, AppLayout.sidebar-resize.test.tsx 7 passed.

AGENT GENERATED

#6 painted ThreadDetailView from threadQueryKey. AppLayout still
disabled useThread until bootstrap settled, so document title and
the favicon attention dot waited on the include GET. useThread now
takes the bootstrap snapshot and applies the same mount policy, so
layout chrome uses the create/list cache immediately.
@Guitaraholic
Guitaraholic changed the base branch from fix/thread-paint-from-cache to main September 2, 2026 19:14
@Guitaraholic
Guitaraholic merged commit 9bb6537 into main Sep 2, 2026
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