From 1932c598ae89a5fb4eee298899d7f5c75326444d Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Wed, 29 Jul 2026 10:43:10 -0300 Subject: [PATCH] fix(dashboard): stop the /home quick-start cards from prefetching too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #8292 fixed half the RSC prefetch storm: it added prefetch={false} to the sidebar's navigation and logo links, but /home — the landing route, and the one its own e2e guard visits — renders five more internal Links in the quick-start cards. First paint still fired 12 speculative RSC requests for /dashboard/{analytics,logs,providers,api-manager} and /docs. That PR shipped the test that would have caught this, but the test never got to its assertion: gotoDashboardRoute("/home") hung because APP_ROUTE_PATTERN accepted only /login and /dashboard, so the retry loop burned the whole 180s timeout with no assertion error. With that helper repaired in the previous commit, navigation.spec.ts finally ran and reported the 12 requests. Validated both ways, per Hard Rule #18: - tests/unit/sidebar-prefetch-policy-8281.test.ts extended to /home — red on the parent commit (5 internal Links, 5 without prefetch={false}), green here. - the e2e assertion expect(speculativeRequests).toEqual([]) is the end-to-end guard; it is what surfaced the defect in the first place. --- CHANGELOG.md | 1 + .../(dashboard)/dashboard/HomePageClient.tsx | 20 ++++++++++++++++--- .../unit/sidebar-prefetch-policy-8281.test.ts | 18 +++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19e2e8c9f5f..e96c67c9e21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1142,6 +1142,7 @@ _Living section — regenerated 2026-07-19 from all 306 cycle commits (bump 2c62 - **fix(api):** stop JSON.stringify-ing messages before estimateTokens (restores #8368 image estimate) [recovered from #8599] ([#8740](https://github.com/diegosouzapw/OmniRoute/pull/8740)) - **fix(quality):** let --update remove baseline entries that already fit the cap ([#8741](https://github.com/diegosouzapw/OmniRoute/pull/8741)) — thanks @MumuTW - **fix:** escape angle brackets in i18n messages to prevent next-intl INVALID_MESSAGE errors ([#8747](https://github.com/diegosouzapw/OmniRoute/pull/8747)) — thanks @SteeleHu +- **fix(dashboard):** the /home quick-start cards no longer prefetch — #8292 opted the sidebar out of automatic route prefetch but left the landing page's own five links untouched, so first paint still fired 12 speculative RSC requests. The e2e guard shipped in that same PR could not catch it: it hung in the auth helper and never reached its assertion until this release's CI. - **fix(dashboard):** Request Logs detail no longer crashes on a structured error object — #7920 introduced `formatErrorForDisplay` for exactly this, but the combo-503 / cooldown checks added by #8213 read the raw field and called `.toLowerCase()` on it. Both paths now share the helper. - **fix(dashboard):** the logs detail modal stops reopening on first close again — #6830 fixed it by reading the deep-link id once, and the #8354 page rewrite regressed it by reading the live `searchParams` on every render, flipping the prop mid-session. ### 📚 Docs diff --git a/src/app/(dashboard)/dashboard/HomePageClient.tsx b/src/app/(dashboard)/dashboard/HomePageClient.tsx index 24cec3140a5..e97cd2a03d2 100644 --- a/src/app/(dashboard)/dashboard/HomePageClient.tsx +++ b/src/app/(dashboard)/dashboard/HomePageClient.tsx @@ -1090,6 +1090,7 @@ export default function HomePageClient({ machineId }: HomePageClientProps) { menu_book @@ -1109,6 +1110,7 @@ export default function HomePageClient({ machineId }: HomePageClientProps) { endpoint: (chunks) => ( {chunks} @@ -1127,7 +1129,11 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {

{t.rich("step2Desc", { providers: (chunks) => ( - + {chunks} ), @@ -1155,12 +1161,20 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {

{t.rich("step4Desc", { logs: (chunks) => ( - + {chunks} ), analytics: (chunks) => ( - + {chunks} ), diff --git a/tests/unit/sidebar-prefetch-policy-8281.test.ts b/tests/unit/sidebar-prefetch-policy-8281.test.ts index 02c170cc711..51aecf0c08a 100644 --- a/tests/unit/sidebar-prefetch-policy-8281.test.ts +++ b/tests/unit/sidebar-prefetch-policy-8281.test.ts @@ -3,6 +3,7 @@ import { readFile } from "node:fs/promises"; import test from "node:test"; const SIDEBAR = "src/shared/components/Sidebar.tsx"; +const HOME_PAGE = "src/app/(dashboard)/dashboard/HomePageClient.tsx"; test("#8281: dashboard navigation opts out of automatic route prefetch", async () => { const source = await readFile(SIDEBAR, "utf8"); @@ -15,3 +16,20 @@ test("#8281: dashboard navigation opts out of automatic route prefetch", async ( assert.ok(logoLink, "expected the sidebar logo home Link"); assert.match(logoLink[0], /prefetch=\{false\}/); }); + +// The sidebar was only half the storm. /home is the landing route, and its +// quick-start cards link to five more dashboard routes — so opting the sidebar +// out still left 12 speculative RSC requests on first paint. The e2e guard +// (navigation.spec.ts) could not catch it: it hung on an unrelated helper bug +// and never reached this assertion until the release-v3.8.49 CI. +test("#8281: the /home quick-start links opt out of prefetch too", async () => { + const source = await readFile(HOME_PAGE, "utf8"); + + const links = source.match(//g) ?? []; + const internal = links.filter((link) => /href="\/(docs|dashboard\/)/.test(link)); + assert.ok(internal.length >= 5, `expected the quick-start links, found ${internal.length}`); + + for (const link of internal) { + assert.match(link, /prefetch=\{false\}/, `internal Link still prefetches: ${link}`); + } +});