Skip to content

Prefetch thread bootstrap on sidebar row pointerdown - #8

Merged
Guitaraholic merged 1 commit into
mainfrom
fix/prefetch-bootstrap-on-pointerdown
Sep 2, 2026
Merged

Prefetch thread bootstrap on sidebar row pointerdown#8
Guitaraholic merged 1 commit into
mainfrom
fix/prefetch-bootstrap-on-pointerdown

Conversation

@Guitaraholic

@Guitaraholic Guitaraholic commented Sep 2, 2026

Copy link
Copy Markdown

Human comments

What was wrong

Create now prefetches bootstrap (Datahazed/bb#7). A sidebar click still started GET /threads/:id?include=environment,host only after ThreadDetailView mounted. That is the common “open a thread from the list” path, web and desktop.

Related: get-bb/bb#1303.

What changed

  • Primary-button pointerdown on a thread row calls prefetchThreadDetailBootstrap, the same helper create uses.
  • Click joins in-flight bootstrap instead of starting it after mount.
  • Right-click / non-primary pointer does not prefetch (context menu should not pay a GET).
  • Split-drag still receives the bubbling pointerdown.

Stacked on #7. No router change. No HOST_DAEMON_PROTOCOL_VERSION bump.

Why this way

Pointerdown is the last moment we know the thread id before navigation (~one frame / ~100 ms before click). Hover prefetch would fire while scrolling a long list. Keyboard Enter still starts bootstrap on mount; that was not the measured stall.

We did not keep the previous thread view hidden, and we did not merge compose+thread. Those are identity changes; this is “start the GET we already own, earlier.”

Benefit to bb

Every thread open from the sidebar, web and desktop. Same product rule as #7: the thread view should join work already in flight. No extra API, no daemon update.

Harvest

Submit after #7 so get-bb reviews prefetchThreadDetailBootstrap once. Copy this body onto a get-bb PR that targets a branch containing #7, or stack.

Decision record: docs/perf-control-plane.md (PR #9).

How you verified

Phase-order tests (apps/app/src/test/perf-phase.ts) fail if the slow order comes back:

  • ThreadRow.test.tsx: bootstrap-prefetch before pointerdown-complete before click-complete. 78 passed.
  • thread-runtime-mutations.test.tsx: bootstrap-get before create-returned. 11 passed.
  • ProjectRow.interactions.test.tsx after adding QueryClient to the row harness. 9 passed.

AGENT GENERATED

Sidebar clicks started GET /threads/:id?include=environment,host only
after ThreadDetailView mounted. Primary-button pointerdown on a row
now starts the same bootstrap query create already uses, so click
joins in-flight work. Right-click does not prefetch.

Phase-order tests record bootstrap-prefetch before click, and keep
create's bootstrap-get before mutateAsync returns.
@Guitaraholic
Guitaraholic force-pushed the fix/prefetch-bootstrap-on-pointerdown branch from 85d0a90 to 64ee345 Compare September 2, 2026 19:20
@Guitaraholic
Guitaraholic changed the base branch from fix/prefetch-bootstrap-on-create to main September 2, 2026 19:20
@Guitaraholic
Guitaraholic merged commit d5afbe4 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