mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-11-16 17:09:09 +00:00
fix(dashboard): stop the /home quick-start cards from prefetching too
#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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1090,6 +1090,7 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {
|
||||
</div>
|
||||
<Link
|
||||
href="/docs"
|
||||
prefetch={false}
|
||||
className="hidden sm:inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium border border-border text-text-muted hover:text-text-main hover:bg-bg-subtle transition-colors"
|
||||
>
|
||||
<span className="material-symbols-outlined text-[14px]">menu_book</span>
|
||||
@@ -1109,6 +1110,7 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {
|
||||
endpoint: (chunks) => (
|
||||
<Link
|
||||
href="/dashboard/api-manager"
|
||||
prefetch={false}
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
{chunks}
|
||||
@@ -1127,7 +1129,11 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {
|
||||
<p className="text-text-muted mt-0.5">
|
||||
{t.rich("step2Desc", {
|
||||
providers: (chunks) => (
|
||||
<Link href="/dashboard/providers" className="text-primary hover:underline">
|
||||
<Link
|
||||
href="/dashboard/providers"
|
||||
prefetch={false}
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
{chunks}
|
||||
</Link>
|
||||
),
|
||||
@@ -1155,12 +1161,20 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {
|
||||
<p className="text-text-muted mt-0.5">
|
||||
{t.rich("step4Desc", {
|
||||
logs: (chunks) => (
|
||||
<Link href="/dashboard/logs" className="text-primary hover:underline">
|
||||
<Link
|
||||
href="/dashboard/logs"
|
||||
prefetch={false}
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
{chunks}
|
||||
</Link>
|
||||
),
|
||||
analytics: (chunks) => (
|
||||
<Link href="/dashboard/analytics" className="text-primary hover:underline">
|
||||
<Link
|
||||
href="/dashboard/analytics"
|
||||
prefetch={false}
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
{chunks}
|
||||
</Link>
|
||||
),
|
||||
|
||||
@@ -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(/<Link[\s\S]*?>/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}`);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user