Skip to content

Restore saved desktop windows concurrently - #6550

Merged
ymichael merged 2 commits into
mainfrom
slopcop/issue-6541
Oct 29, 2026
Merged

ymichael merged 2 commits into
mainfrom
slopcop/issue-6541

Conversation

@bb-slop-cop

@bb-slop-cop bb-slop-cop Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Human comments

Scope trimmed to the saved-window restore. The native menu cache was dropped: a menu rebuild measured about 2-3 ms, which does not justify a module-level cache and in-place callback swapping.

What was wrong

Saved-window restoration awaited each window's initial page load before creating the next window, so startup with N saved windows paid N page loads back to back and delayed runtime startup until the last one finished.

Reproduced against main at 3bacfac9ed69d42392076e5b3da2815bec822cd8 with the real desktop build, 5 saved windows, and a remote server target. Windows were created 80-100 ms apart and all 5 showed the bb app at 790-1094 ms after launch (3 runs).

What changed

  • restoreSavedWindows starts every saved window's creation and navigation together with Promise.all, keeping the returned windows in saved order and the existing empty-state fallback.
  • Added a regression test: all three saved pages start before any finishes, and the result keeps saved order.

How you verified

  • Same real-desktop probe on this branch: windows created about 12 ms apart, all 5 showing the bb app at 555-746 ms (3 runs), roughly 60-80 ms saved per extra window.
  • The new test fails against main's sequential loop and passes with the change.
  • pnpm exec turbo run typecheck --filter=@bb/desktop passes.
  • pnpm exec turbo run test --filter=@bb/desktop -- test/desktop-window-factory.test.ts test/menu.test.ts: 46 tests pass.
  • Behaviour note: the window that ends up focused at startup is now whichever finishes loading last, instead of the last saved entry. The old choice was arbitrary too.

Fixes #6541

AGENT GENERATED

Rebuilding the application menu costs about 2-3 ms per refresh, which
does not justify a module-level cache and in-place callback swapping.
The concurrent saved-window restore stays: it cuts about 60-80 ms per
extra window from desktop startup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael ymichael changed the title Restore desktop pages concurrently and reuse equivalent native menus Restore saved desktop windows concurrently Oct 29, 2026
@ymichael
ymichael merged commit 0c6d4e7 into main Oct 29, 2026
27 checks passed
@ymichael
ymichael deleted the slopcop/issue-6541 branch October 29, 2026 17:23
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.

Desktop: saved windows open one at a time on startup, and the menu rebuilds when nothing changed

2 participants