Repository navigation
fix: lazy-load @pierre/diffs and Shiki engine off critical render path - #1070
toasterman234 wants to merge 1 commit into
Conversation
Lazy-loads ThreadDetailWorkerPoolProvider, RootComposeView, and
PluginPanelView's WorkerPoolContextProvider behind Suspense boundaries
so the heavy syntax-highlighting engine (~80KB Shiki core + ~170
language grammar registry) no longer blocks initial thread view paint.
Changes:
- SplitThreadArea: lazy(() => import ThreadDetailWorkerPoolProvider)
wrapped in <Suspense fallback={null}>
- New LazyWorkerPoolProvider component for RootComposeView and
PluginPanelView to avoid static @pierre/diffs imports
- Vite build config: chunkSizeWarningLimit raised to 800KB
(workspace-checkout-display at ~1.7MB tracked separately)
- New check-bundle-budget.mjs CI script
- Updated tests: parity + stories tests mock lazy providers
Results:
- workspace-checkout-display: 2.3MB → 1.7MB (-600KB, -26%)
- Shiki engine fully removed from critical rendering path
- diff/file-preview bootstrap: <3KB (down from bundling 814KB worker)
- All 315 test files (2366 tests) passing
Refs: get-bb#1063
Co-authored-by: Ben Charney <[email protected]>
Signed-off-by: Ben Charney <[email protected]>
|
thank you this was bothering me too |
|
Thanks for digging into this, and sorry for the collision — I had #1071 in flight on the same issue before I spotted yours. Closing this one in favour of that, and I've added you as a co-author there since you were onto the problem independently. Being straight about what differed, in case it's useful: The three views this PR touches — On the budget script: I measured the flat 500 KB per-chunk rule against the optimised build and 8 chunks still fail it — Your idea is still worth landing, though, and I'd welcome it as a follow-up. Measuring the landing route on top of #1071 turned up something neither PR fixes: One thing to watch if you rebase onto #1071: |
Closes #1063
Problem
bb on iPhone was "insanely laggy" because the critical rendering path bundled the entire Shiki syntax-highlighting engine (~80KB core + 170-language grammar registry) and @pierre/diffs worker pool into
workspace-checkout-display(2.3MB). Every click triggered a massive JS parse/compile cycle on mobile WebKit.What this does
Lazy-loads the diff worker pool provider behind Suspense boundaries so the thread view renders immediately without Shiki:
lazy(() => import(ThreadDetailWorkerPoolProvider))wrapped in<Suspense fallback={null}>@pierre/diffsimportsscripts/check-bundle-budget.mjs) and chunkSizeWarningLimit bumped to 800KBResults
workspace-checkout-display@pierre/diffsbootstrapworkspace-checkout-display(grep clean)workspace-checkout-displayis the Monaco/Eddie code editor — tracked in Cut the web app boot payload by 60% #1071How to verify
cd apps/app && pnpm vite buildgrep createHighlighter dist/assets/workspace-checkout-display-*.jsshould be emptynode scripts/check-bundle-budget.mjs