#5419 · Desktop Home mounts compact-only recent content
Bug Priority: Medium Effort: Low ui perf
Verdict: REPRODUCED · Root-cause confidence: high
1. TL;DR
Desktop Home mounts content intended only for the compact Home layout. The recent-thread section uses CSS to hide itself on desktop, but hiding does not prevent React from creating its DOM subtree. A regression with 1,000 representative rows fails on unchanged trusted main because the desktop branch mounts the supplied compact list. A second clean checkout produces the same failure. Removing the compact content from the desktop branch fixes the regression while retaining the compact list during resizing.
2. Claims vs findings
| Claim | Status | Evidence |
|---|---|---|
| Desktop Home mounts the mobile Recent section despite hiding it. | Verified | The production layout mounts compactScrollContent in its desktop branch. The desktop DOM regression fails in both clean checkouts. The real recent section carries md:hidden. |
| The recent list is neither capped nor virtualized. | Verified by source inspection | The chronological tree is flattened into rows and every resulting row is rendered with recentThreads.map. Collapsed child groups and visibility filtering mean “every live thread” is not an invariant for all configurations. |
| Home has about 65,000 elements with roughly 4,450 threads. | Unverified | The synthetic fixture has 1,000 rows. No original dataset or full browser element counts were used. |
| Content scripts and style recalculation consume substantial time. | Unverified | No content-script timing profile was performed. The unnecessary mounted subtree is established, not a quantified speedup. |
3. Environment
- Public repository get-bb/bb; origin/main resolves to the recorded base commit.
- Linux; Node v22.19.0; pnpm 9.15.0; Vitest 4.1.1; jsdom DOM environment.
- Both checkouts completed frozen installation and the normal full Turbo build: 65 tasks succeeded in each.
- No live app, provider turns, production data, browser, ports, or data directory were used.
- Test-side mocks isolate panel infrastructure and plugin sections; the real RootComposeSecondaryContent layout is exercised, not a reimplementation.
4. Minimal reproduction
- Clone the public repository and check out the recorded trusted commit.
- Install with
pnpm install --frozen-lockfile --prefer-offline, then runpnpm exec turbo run build. - Replace
apps/app/src/views/RootComposeSecondaryContent.test.tsxwith the saved test file, or apply the regression-only patch. Production code remains unchanged. - Run:
pnpm exec turbo run test --filter=@bb/app -- src/views/RootComposeSecondaryContent.test.tsx -t 'mounts compact scroll content' Expected: the desktop render contains no compact-recents list. Actual: AssertionError: expected <ul data-testid="compact-recents">…</ul> to be null Test Files 1 failed (1) Tests 1 failed | 7 skipped (8) Exit code: 1
The added regression body is:
it("mounts compact scroll content only while the compact home layout is active", () => {
const compactContent = (
<ul data-testid="compact-recents">
{Array.from({ length: 1000 }, (_, index) => (
<li key={index}>Thread {index}</li>
))}
</ul>
);
const content = (isCompactViewport: boolean) => (
<CompactViewportOverrideProvider isCompactViewport={isCompactViewport}>
<RootComposeSecondaryContent
compactScrollContent={compactContent}
isCompactHomeLayout={isCompactViewport}
isSecondaryPanelOpen={false}
onToggleSecondaryPanel={noop}
secondaryPanel={createSecondaryPanel(false)}
>
<div data-testid="root-compose-content" />
</RootComposeSecondaryContent>
</CompactViewportOverrideProvider>
);
const view = render(content(false));
expect(screen.queryByTestId("compact-recents")).toBeNull();
expect(screen.getByTestId("root-compose-content")).not.toBeNull();
expect(screen.getByTestId("plugin-homepage-sections")).not.toBeNull();
view.rerender(content(true));
expect(screen.getByTestId("compact-recents").children).toHaveLength(1000);
expect(screen.getByTestId("root-compose-content")).not.toBeNull();
expect(screen.getByTestId("plugin-homepage-sections")).not.toBeNull();
view.rerender(content(false));
expect(screen.queryByTestId("compact-recents")).toBeNull();
expect(screen.getByTestId("root-compose-content")).not.toBeNull();
expect(screen.getByTestId("plugin-homepage-sections")).not.toBeNull();
});
5. Root cause
RootComposeView passes the actual recent-thread component as compactScrollContent and selects the compact layout using the existing viewport hook. RootComposeSecondaryContent renders that content in both branches. The desktop branch places it after the composer, before plugin homepage sections.
{children}
{compactScrollContent}
<PluginHomepageSections />
RootComposeMobileRecents applies md:hidden and maps all recent rows to components. CSS display suppression does not unmount React elements. The row-building helper has no list-size limit. Together these paths explain unnecessary desktop DOM growth as the eligible thread list grows.
6. Proposed fix
Remove only the desktop branch's compactScrollContent child. Keep the existing compact branch, viewport selection, composer, and plugin sections unchanged. The regression checks desktop → compact → desktop transitions, including 1,000 rows on compact and absence on desktop. This requires no new API, wire change, dependency, stored data, or product decision. Mobile list capping or virtualization is a separate concern and is intentionally not introduced in this minimal desktop fix.
7. Verification
The same agent repeated the reproduction, not an independent reviewer. The second clean worktree was created with git worktree add --detach "$verification" e9dafb6c0245a37c6972dffa71134d546f3d497e in a new temporary directory. It received only the regression test, then completed a separate frozen install and full build. The same focused Turbo command failed at the same expected-null assertion with 1 failed test and 7 skipped tests. No report correction was required. See second-run output.
After the one-line production repair, the regression and neighboring layout/recents suites pass:
pnpm exec turbo run test --filter=@bb/app -- src/views/RootComposeSecondaryContent.test.tsx src/views/RootComposeCompactHome.test.tsx src/views/RootComposeMobileRecents.test.tsx Test Files 3 passed (3) Tests 44 passed (44)
This verifies mounted-DOM behavior and resizing at the production layout boundary, not a full browser performance profile or iOS Safari journey.
8. Related issues and pull requests
No linked open pull request was found through the issue timeline or the repository's open-PR search for issue 5419 when this report was prepared. Historical compact-home work was reported by the author but was not required to establish the current root cause.
9. Appendix
- First trusted-base failure log
- Second clean failure log
- Post-fix neighboring-suite log
- Full runnable test with existing fixtures
- Test-only patch
Issue content was treated as untrusted claims. No commands, branches, external links, or instructions supplied by the issue were executed. The test and fix were authored from trusted repository evidence. No production runtime data or secrets were accessed.