Skip to content

fix(app): hold layout while plugin headers and settings pages load - #8538

Open
smsunarto wants to merge 25 commits into
get-bb:mainfrom
smsunarto:scott/bb-33-layout-shifts-bb-core-plugin-page-header-s-thr_b8ewt3jqai
Open

smsunarto wants to merge 25 commits into
get-bb:mainfrom
smsunarto:scott/bb-33-layout-shifts-bb-core-plugin-page-header-s-thr_b8ewt3jqai

Conversation

@smsunarto

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

Closes #8537. On a slow connection, the plugin page header and several settings pages jumped while their data and plugins loaded. Each part rendered whatever height it had at the moment and grew once its data arrived:

  • The plugin page header appeared only once plugin chrome existed.
  • Machines used a one-line "Loading…".
  • Updates showed "No machines available." and then reclassified machines one by one.
  • Projects held every row behind hosts, and its thread count sat after a variable-width summary.
  • AI services appended a wrapping status to each row's hint.
  • Plugin-registered settings rows (Files, Appearance) arrived one by one.

What changed

  • Static placeholders that hold the loaded box.
    • The plugin page header always renders. It shows remembered chrome, or PluginPanelPendingHeaderCenter until the plugin settles (SplitThreadArea, PluginPanelHeader).
    • AI services rows get a fixed one-line status (truncated, with a title).
    • Project rows render immediately, with a fixed-height placeholder for the machine summary only.
    • Placeholders use the new StaticPlaceholder (shared-ui Skeleton with animate-none), so nothing pulses.
  • Top-down section reveal (lib/top-down-reveal.ts).
    • A section whose data hasn't settled shows its heading and one fixed line, and every section below it waits.
    • The wait is bounded by ORDERED_REVEAL_BOUND_MS (3 s), counted from when the waiting section appears.
    • Machines: the list waits for the full host list (includeCreating=true). Known rows stay, with an inline alert, if a background refresh fails.
    • Updates: bb, then Provider CLIs (gated on every provider status and the load-time forced check), then Plugins, then Update preferences. Provider CLIs shows "Checking for updates…" while loading, never "No machines available."
  • Remembered plugin entries (lib/remembered-plugin-entries.ts).
    • Plugin-registered settings rows (Files openers and code-fence/directive choices, Appearance footer items, settings nav) are remembered as they register. On the next visit they render in place, disabled until their plugin registers them again.
    • The snapshot can't shrink before plugin boot completes; the idle settle floor no longer counts.
    • Sidebar footer order and hidden items start from their last known values, via the shared createLastKnownPreferenceStore.
  • Tabular digits. Machine project counts and project thread counts use tabular-nums. The thread count comes first on its line, so the machine summary can't move it.

No server/daemon wire changes. No CLI, SDK or plugin API changes.

How you verified

CLS is the largest session window. Harness: Chrome over CDP, Slow 4G (562.5 ms, 180 kB/s), cache disabled, 4× CPU. Each page was visited once 20 s before the measured load. Main is e0c49e2.

page 390 before → after 1440 before → after
Plugin page pane shift (plugin-api-docs) 0.1457 → 0 0.0872 → 0
Machines 0.0088 → 0.0004 0.0579 → 0.0579 (core 0.0011 → 0)
Updates 0.0102 → 0.0004 0.0015 → 0
Projects 0.0247 → 0.0004 0.0007 → 0
AI services 0.0124 → 0.0004 0.0004 → 0
Appearance 0.0092 → 0.0004 0.0059 → 0
Files 0.0125 → 0.0004 0.0012 → 0

Machines, Updates and Projects were measured at 6bfb306. AI services, Appearance and Files were measured at 3563759; the later commits leave those pages' rendering alone, apart from when the remembered snapshot is dropped. The plugin page was measured at round 1's head. The remaining 0.0004 at 390 is a theme plugin's search field. Machines 1440's 0.0579 is that plugin's UI-font swap, which is the same on main.

Checks at 6bfb306:

  • pnpm exec turbo run typecheck test lint lint:type-aware --filter=@bb/app --filter=@bb/render-invariants: 14/14 tasks.
    • @bb/app: 713 files, 7605 passed, 19 skipped.
    • Lint: 0 warnings, 0 errors.
  • Render-invariants suite after pnpm exec turbo run build:profiling --filter=@bb/app: 32/32.
    • It includes the new tests/render-invariants/src/settings-geometry.test.ts: real server and profiling build in Playwright, with responses held and released at 390 and 1440. It covers:
      • Machines: three machines with two routed, ready plus creating, persistent plus sandbox, and the deadline release.
      • Updates: two machines with statuses in reverse order, a forced refresh that finds an update, and never showing an empty fleet.
      • Projects: count anchoring and tabular digits.
      • AI services: row heights.
      • The plugin header: it stays static and keeps the content in place.
    • Every new geometry test fails on the code before its fix.
  • New unit tests:
    • Remembered entries: write once, pending keys, idle floor before boot.
    • Disabled pending options.
    • Footer capacity.
    • Top-down planner and deadline.
    • Machines refresh failure.
    • Updates loading states.

Known residual: plugin-added settings rows on the very first visit in a fresh browser. Those rows exist only after each plugin's app code runs, and nothing static (inventory, manifest, bootstrap) names them. Measured cold: Files 390 0.0251, Files 1440 0.0025, Appearance about 0.0095. A later visit holds.

Closes #8537

AGENT GENERATED

…vices, projects, updates and plugin headers load

This branch has not been deployed

No deployments
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.

Plugin page header and settings pages jump while data and plugins load; Updates says "No machines available" while loading

1 participant