mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 06:42:12 +03:00
refactor(dashboard): shrink HomePageClient back under the size gate
The prefetch fix in the parent commit tripped check:file-size — the frozen
budget for this file is 1377 lines and a naive fix measured 1391, because
`href` + `prefetch={false}` + `className` no longer fits Prettier's 100-column
budget, so three one-line <Link> elements each expanded to five.
Followed the gate's own first suggestion (extract/DRY) before touching the
baseline: the quick-start links repeated the same className literal four
times, and the docs link carried a 180-char one inline. Hoisting both into
INLINE_LINK / DOCS_LINK collapses five wrapped <Link> blocks back to a single
line each and removes the duplication — 1391 -> 1381.
The remaining +4 over the frozen budget is the five prefetch attributes
themselves, which cannot be expressed in fewer lines. Rebaselined to 1381
with the rationale recorded in file-size-baseline.json under
_rebaseline_2026_07_29_8281_home_quickstart_prefetch.
tests/unit/sidebar-prefetch-policy-8281.test.ts still passes (2/2): it matches
whole <Link ...> blocks, so it is indifferent to the wrapping and only checks
that every internal link opts out of prefetch.
This commit is contained in:
@@ -366,7 +366,7 @@
|
||||
"open-sse/translator/response/openai-responses.ts": 1174,
|
||||
"open-sse/utils/cursorAgentProtobuf.ts": 1505,
|
||||
"open-sse/utils/stream.ts": 2887,
|
||||
"src/app/(dashboard)/dashboard/HomePageClient.tsx": 1377,
|
||||
"src/app/(dashboard)/dashboard/HomePageClient.tsx": 1381,
|
||||
"src/app/(dashboard)/dashboard/analytics/ComboHealthTab.tsx": 1031,
|
||||
"src/app/(dashboard)/dashboard/api-manager/ApiManagerPageClient.tsx": 3117,
|
||||
"src/app/(dashboard)/dashboard/cache/media/MediaPageClient.tsx": 1067,
|
||||
@@ -412,5 +412,6 @@
|
||||
"_rebaseline_2026_07_28_8842_antigravity_test": "PR #8842 test growth: tests/unit/executor-antigravity.test.ts new testFrozen 1098 (4 new test cases for projectId discovery during refresh: discovers when empty, skips when set, handles failure, skips when access_token not a string). All above cap 1000 on day one.",
|
||||
"_rebaseline_2026_07_28_8860_tokenrefresh_projectid": "PR #8860 (fix/antigravity-projectid-centralized) own test growth: tests/unit/token-refresh-service.test.ts 1311->1378 (+67 = 4 cases covering projectId discovery on the tokenRefresh.ts path — the Dashboard/health-check refresh route, which #8842 did not reach since that fixed the executor path). Covered by the same file.",
|
||||
"_rebaseline_2026_07_28_8861_xiaomi_token_plan": "PR #8861 (feat/xiaomi-token-plan-protocol-selector) own growth: EditConnectionModal.tsx 1283->1316 (+33 = the per-connection API-protocol selector field) and open-sse/executors/base.ts 1540->1562 (+22 = alternate-format resolution at the existing buildUrl/headers chokepoint). Both are irreducible wiring at existing call sites.",
|
||||
"_rebaseline_2026_07_28_8863_firefly_detail_level": "PR #8863 (fix/adobe-firefly-gpt-detail-level-max) own growth: adobeFireflyClient.ts 2317->2322 (+5 = gpt-image detailLevel defaulting to maximal at the existing payload-build site). Covered by tests/unit/adobe-firefly.test.ts."
|
||||
"_rebaseline_2026_07_28_8863_firefly_detail_level": "PR #8863 (fix/adobe-firefly-gpt-detail-level-max) own growth: adobeFireflyClient.ts 2317->2322 (+5 = gpt-image detailLevel defaulting to maximal at the existing payload-build site). Covered by tests/unit/adobe-firefly.test.ts.",
|
||||
"_rebaseline_2026_07_29_8281_home_quickstart_prefetch": "Release v3.8.49 base-red fix (no PR — captain sweep): src/app/(dashboard)/dashboard/HomePageClient.tsx 1377->1381 (+4). #8292 added prefetch={false} to the sidebar but left /home's five quick-start Links prefetching, so first paint still fired 12 speculative RSC requests — caught by navigation.spec.ts only after the e2e helper bug (APP_ROUTE_PATTERN missing /home) was repaired in the same cycle. Growth is the five prefetch attributes; it was offset first by extracting the repeated className literals (INLINE_LINK x4, DOCS_LINK x1), which collapsed five wrapped <Link> blocks back to one line each — a naive fix measured 1391. Guard: tests/unit/sidebar-prefetch-policy-8281.test.ts."
|
||||
}
|
||||
|
||||
@@ -104,6 +104,12 @@ function mergeUpdateStep(steps: UpdateStep[], nextStep: UpdateStep) {
|
||||
return next;
|
||||
}
|
||||
|
||||
// Quick-start link classes, extracted so each <Link> still fits on one line with
|
||||
// prefetch={false} (#8281) — this file is size-frozen.
|
||||
const INLINE_LINK = "text-primary hover:underline";
|
||||
const DOCS_LINK =
|
||||
"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";
|
||||
|
||||
export default function HomePageClient({ machineId }: HomePageClientProps) {
|
||||
const router = useRouter();
|
||||
const isElectron = useIsElectron();
|
||||
@@ -1088,11 +1094,7 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {
|
||||
<h2 className="text-lg font-semibold">{t("quickStart")}</h2>
|
||||
<p className="text-sm text-text-muted">{t("quickStartDesc")}</p>
|
||||
</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"
|
||||
>
|
||||
<Link href="/docs" prefetch={false} className={DOCS_LINK}>
|
||||
<span className="material-symbols-outlined text-[14px]">menu_book</span>
|
||||
{t("fullDocs")}
|
||||
</Link>
|
||||
@@ -1111,7 +1113,7 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {
|
||||
<Link
|
||||
href="/dashboard/api-manager"
|
||||
prefetch={false}
|
||||
className="text-primary hover:underline"
|
||||
className={INLINE_LINK}
|
||||
>
|
||||
{chunks}
|
||||
</Link>
|
||||
@@ -1129,11 +1131,7 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {
|
||||
<p className="text-text-muted mt-0.5">
|
||||
{t.rich("step2Desc", {
|
||||
providers: (chunks) => (
|
||||
<Link
|
||||
href="/dashboard/providers"
|
||||
prefetch={false}
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
<Link href="/dashboard/providers" prefetch={false} className={INLINE_LINK}>
|
||||
{chunks}
|
||||
</Link>
|
||||
),
|
||||
@@ -1161,20 +1159,12 @@ export default function HomePageClient({ machineId }: HomePageClientProps) {
|
||||
<p className="text-text-muted mt-0.5">
|
||||
{t.rich("step4Desc", {
|
||||
logs: (chunks) => (
|
||||
<Link
|
||||
href="/dashboard/logs"
|
||||
prefetch={false}
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
<Link href="/dashboard/logs" prefetch={false} className={INLINE_LINK}>
|
||||
{chunks}
|
||||
</Link>
|
||||
),
|
||||
analytics: (chunks) => (
|
||||
<Link
|
||||
href="/dashboard/analytics"
|
||||
prefetch={false}
|
||||
className="text-primary hover:underline"
|
||||
>
|
||||
<Link href="/dashboard/analytics" prefetch={false} className={INLINE_LINK}>
|
||||
{chunks}
|
||||
</Link>
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user