You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Thread route still statically imports the 2.15 MB shared chunk (+ katex): FilePreview → @pierre/diffs, markdown-preview → rehype-katex, PromptBox → tiptap should be lazy #1072
After #1070 removed Shiki from the critical path, workspace-checkout-display is still 1.7MB and preloaded via <link rel="modulepreload"> in the HTML shell. This means every thread page load pulls in the full code editor before rendering.
index.js eagerly includes modules that import formatWorkspaceCheckoutDisplay from @/lib/workspace-checkout-display. Vite sees this as a static dependency and bundles the entire editor tree into the preload set.
Split @/lib/workspace-checkout-display into a light type-only module and a heavy implementation module. The type is used everywhere; the implementation (which pulls in the editor) should be lazy-loaded.
Lazy-load the actual editor — ThreadDetailView, ThreadMetadataContent, and PluginThreadChat only need formatWorkspaceCheckoutDisplay for rendering a small environment label. That function shouldn't pull in the full editor.
Audit why Cytoscape and Katex are bundled here — they should be in their own lazy chunks.
Target
workspace-checkout-display under 500KB (from current 1.7MB)
No editor code in HTML modulepreload
Thread view first paint: no editor parsing on critical path
Verdict: PARTIALLY REPRODUCED · root-cause confidence: high
Root cause (short): The HTML-shell preload of the 2.4MB shared chunk was fixed by Cut the web app boot payload by 60% #1071 (eager edge was App.tsx→usePluginFrontendBoot→plugin-frontend.ts, not the 85-line workspace-checkout-display module that merely lends the chunk its name); but the same 2.15MB chunk plus katex is still a static import of the lazy thread route (SplitWorkspaceRoute) via FilePreview→@pierre/diffs, markdown-preview→rehype-katex, PromptBoxInternal→tiptap, useThreadStorageBrowser→@pierre/trees and thread-operation-prompts→handlebars, so a thread page still parses ~3.3MB of editor/diff/tree/math/template code before first paint.
Proposed fix: Retitle the issue (the module-split idea is a no-op; Monaco/Cytoscape claims are wrong). Then in apps/app cut the static edges that put heavy packages on the thread route: React.lazy the Pierre file viewer inside secondary-panel/FilePreview.tsx; make ui/markdown-preview.tsx load rehype-katex + katex CSS lazily only when remark-math finds a math node (same pattern as MarkdownMermaidDiagram); move @pierre/trees into a lazily loaded storage-browser tab; dynamic-import @bb/templates (Handlebars) inside the git-action handler or precompile the templates; lazy-load PromptBoxInternal (Tiptap/ProseMir…
Caveats: Revision: the browser repro was made runnable by others (new browser-thread-page-loads.sh wrapper takes project/thread/port; dev-browser's QuickJS sandbox has no process.env so a placeholder+wrapper is used; waitUntil load + 6s instead of networkidle) and re-run end to end on a fresh dev instance (server :24027, proj_6b34bf5w5e / thr_v52fuawjmu); the JSON artifact and screenshot were regenerated a…
The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at 16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).
changed the title [-]workspace-checkout-display (1.7MB) bundles Monaco/Eddie editor eagerly — should be lazy[/-][+]Thread route still statically imports the 2.15 MB shared chunk (+ katex): FilePreview → @pierre/diffs, markdown-preview → rehype-katex, PromptBox → tiptap should be lazy[/+]on Aug 18, 2026
Retitled to match what reproduced (https://get-bb.github.io/reports/issues/1072.html). Refuted: workspace-checkout-display is an 85-line module that merely lends the chunk its name; the eager HTML-shell preload edge (App.tsx → usePluginFrontendBoot → plugin-frontend.ts) was fixed by #1071, and the Monaco/Cytoscape attributions were wrong. What is still true: the same 2.15 MB chunk plus katex CSS is a static import of the lazy thread route (SplitWorkspaceRoute) through FilePreview → @pierre/diffs, ui/markdown-preview → rehype-katex, and PromptBoxInternal → tiptap. Making those three edges React.lazy/dynamic is the remaining work.
Activity
fix: strip heavy modulepreload links from index.html after vite build
fix: force workspace-checkout-display into standalone chunk
SawyerHood commentedon Aug 7, 2026
Yeah agree we should move this off of the critical path.
Load the diff renderer and KaTeX on demand (#1072)
Address the Slop Cop review on #1072
SawyerHood commentedon Aug 18, 2026
Reproduction & root-cause report: https://get-bb.github.io/reports/issues/1072.html
The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at
16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).[-]workspace-checkout-display (1.7MB) bundles Monaco/Eddie editor eagerly — should be lazy[/-][+]Thread route still statically imports the 2.15 MB shared chunk (+ katex): FilePreview → @pierre/diffs, markdown-preview → rehype-katex, PromptBox → tiptap should be lazy[/+]SawyerHood commentedon Aug 18, 2026
Retitled to match what reproduced (https://get-bb.github.io/reports/issues/1072.html). Refuted:
workspace-checkout-displayis an 85-line module that merely lends the chunk its name; the eager HTML-shell preload edge (App.tsx → usePluginFrontendBoot → plugin-frontend.ts) was fixed by #1071, and the Monaco/Cytoscape attributions were wrong. What is still true: the same 2.15 MB chunk plus katex CSS is a static import of the lazy thread route (SplitWorkspaceRoute) through FilePreview → @pierre/diffs, ui/markdown-preview → rehype-katex, and PromptBoxInternal → tiptap. Making those three edgesReact.lazy/dynamic is the remaining work.Load the thread storage file tree on demand (#2139)