Skip to content

ssr benchmarks#7606

Merged
Sheraff merged 9 commits into
mainfrom
benchmark-ssr-scenarios
Jun 12, 2026
Merged

ssr benchmarks#7606
Sheraff merged 9 commits into
mainfrom
benchmark-ssr-scenarios

Conversation

@Sheraff

@Sheraff Sheraff commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added comprehensive SSR performance benchmarks (React, Solid, Vue) covering control-flow, head, loaders, selective SSR, assets, global middleware, rewrites, and serialization.
    • Generalized deterministic request loop with customizable request/build/validation hooks.
  • Documentation

    • Updated SSR benchmark README with scenario responsibilities and streamlined run instructions.
  • Chores

    • Added seroval and updated build/test targets to support scenario-specific builds and typechecks.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)
📝 Walkthrough

Walkthrough

The PR generalizes the SSR benchmark request loop, updates benchmark documentation and Nx wiring, and adds multiple SSR scenario apps for React, Solid, and Vue covering control flow, head, loaders, selective SSR, assets, before-load, global middleware, rewrites, and serialization.

Changes

SSR benchmarks

Layer / File(s) Summary
Shared harness and workspace wiring
benchmarks/ssr/README.md, benchmarks/ssr/bench-utils.ts, benchmarks/ssr/package.json, benchmarks/ssr/react/project.json, benchmarks/ssr/scenarios/*/project.json
Documents the benchmark layout and commands, replaces the SSR-specific request loop with a generic loop API, rewires root Nx targets, and adds scenario project targets.
Control-flow and head scenarios
benchmarks/ssr/scenarios/control-flow/*, benchmarks/ssr/scenarios/head/*
Adds shared control-flow and head assertions plus React, Solid, and Vue benchmark apps with generated route trees, route handlers, benchmark suites, and per-framework configs.
Loaders and selective SSR scenarios
benchmarks/ssr/scenarios/loaders/*, benchmarks/ssr/scenarios/selective-ssr/*
Adds deterministic loader data and selective SSR assertions, then implements both scenario families across the three frameworks.
Assets and before-load scenarios
benchmarks/ssr/scenarios/assets/*, benchmarks/ssr/scenarios/before-load/*
Adds shared asset and before-load helpers, plus per-framework apps with routes, SSR server entries, styles, and benchmark runners.
Global middleware scenario
benchmarks/ssr/scenarios/global-middleware/*
Adds middleware marker helpers, benchmark setup and assertions, and React, Solid, and Vue apps that exercise document, server route, and server function flows.
Rewrites and serialization scenarios
benchmarks/ssr/scenarios/rewrites/*, benchmarks/ssr/scenarios/serialization/*
Adds shared rewrite and serialization helpers, router rewrite logic, serialization adapters, and per-framework apps and benchmarks for both scenario families.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • TanStack/router#7579: Also changes the SSR benchmark harness and benchmark entry execution around shared request-loop behavior.
  • TanStack/router#6803: Also updates benchmarks/ssr/bench-utils.ts request-loop behavior for SSR benchmark execution.

Suggested labels

documentation

Suggested reviewers

  • schiller-manuel
  • SeanCassiere

Poem

🐇 I thumped through routes in moonlit air,
With loaders, heads, and links to share.
Middleware hopped in tidy rows,
While benchmark carrots neatly rose.
Through rewrites, streams, and SSR light,
This warren hums just right tonight.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch benchmark-ssr-scenarios

@nx-cloud

nx-cloud Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 8524c9e

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 3m 27s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 25s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-12 18:02:19 UTC

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

3 package(s) bumped directly, 10 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/react-router 1.170.15 → 1.170.16 Changeset
@tanstack/solid-router 1.170.15 → 1.170.16 Changeset
@tanstack/start-server-core 1.169.14 → 1.169.15 Changeset
@tanstack/react-start 1.168.25 → 1.168.26 Dependent
@tanstack/react-start-client 1.168.13 → 1.168.14 Dependent
@tanstack/react-start-rsc 0.1.24 → 0.1.25 Dependent
@tanstack/react-start-server 1.167.19 → 1.167.20 Dependent
@tanstack/solid-start 1.168.25 → 1.168.26 Dependent
@tanstack/solid-start-client 1.168.13 → 1.168.14 Dependent
@tanstack/solid-start-server 1.167.19 → 1.167.20 Dependent
@tanstack/start-plugin-core 1.171.17 → 1.171.18 Dependent
@tanstack/vue-start 1.168.24 → 1.168.25 Dependent
@tanstack/vue-start-server 1.167.19 → 1.167.20 Dependent

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: f7b05b2051fb
  • Measured at: 2026-06-12T18:00:04.722Z
  • Baseline source: history:96eca43ab8ee
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 87.29 KiB 0 B (0.00%) 87.15 KiB 273.66 KiB 75.88 KiB ▁▁▁▁▁▁▁▁▃██
react-router.full 91.02 KiB 0 B (0.00%) 90.88 KiB 285.56 KiB 79.09 KiB █████▁▁▁▁▄▄
solid-router.minimal 35.48 KiB 0 B (0.00%) 35.36 KiB 105.86 KiB 32.03 KiB ▆▆▆▆▆▆█▁▁▁▁
solid-router.full 40.53 KiB 0 B (0.00%) 40.41 KiB 121.08 KiB 36.46 KiB ▆▆▆▆▆▆█▁▁▁▁
vue-router.minimal 52.97 KiB 0 B (0.00%) 52.84 KiB 149.90 KiB 47.62 KiB ██████▁▁▁▁▁
vue-router.full 58.96 KiB 0 B (0.00%) 58.83 KiB 168.66 KiB 52.87 KiB ▁▁▁▁▁▁█████
react-start.minimal 101.91 KiB 0 B (0.00%) 101.77 KiB 321.98 KiB 88.21 KiB ▁▁▁▁▁▁▂▂▃██
react-start.deferred-hydration 102.65 KiB 0 B (0.00%) 101.80 KiB 323.36 KiB 88.90 KiB ▁▁▁▁▁▂▂▂▂██
react-start.full 105.31 KiB 0 B (0.00%) 105.18 KiB 331.91 KiB 91.06 KiB ▃████▁▁▁▂▆▆
react-start.rsbuild.minimal 99.63 KiB 0 B (0.00%) 99.46 KiB 316.43 KiB 85.79 KiB ▃▃▃▃▃▁▂▂▃██
react-start.rsbuild.minimal-iife 100.03 KiB 0 B (0.00%) 99.87 KiB 317.37 KiB 86.08 KiB ▃▃▃▃▃▁▂▂▃██
react-start.rsbuild.full 102.86 KiB 0 B (0.00%) 102.68 KiB 326.48 KiB 88.53 KiB ▅████▁▁▁▁▅▅
solid-start.minimal 49.60 KiB 0 B (0.00%) 49.47 KiB 151.93 KiB 43.79 KiB ▆▆▆▆▆▆█▁▁▁▁
solid-start.deferred-hydration 52.86 KiB 0 B (0.00%) 49.53 KiB 159.97 KiB 46.81 KiB ▄▄▄▄▄▄█▁▁▁▁
solid-start.full 55.40 KiB 0 B (0.00%) 55.27 KiB 168.97 KiB 48.80 KiB ▁▇▇▇▇▇█▆▆▆▆
vue-start.minimal 71.02 KiB 0 B (0.00%) 70.89 KiB 207.04 KiB 62.93 KiB ▁▁▁▁▁▁█████
vue-start.full 75.01 KiB 0 B (0.00%) 74.88 KiB 219.68 KiB 66.40 KiB ▁▇▇▇▇▇█████

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7606

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7606

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7606

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7606

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7606

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7606

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7606

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7606

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7606

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7606

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7606

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7606

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7606

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7606

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7606

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7606

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7606

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7606

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7606

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7606

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7606

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7606

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7606

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7606

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7606

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7606

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7606

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7606

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7606

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7606

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7606

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7606

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7606

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7606

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7606

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7606

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7606

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7606

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7606

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7606

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7606

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7606

commit: 8524c9e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 17

🧹 Nitpick comments (2)
benchmarks/ssr/scenarios/selective-ssr/react/src/routes/__root.tsx (1)

8-11: Document the benchmark tradeoff (or parse q) instead of type-casting in validateSearch.

In benchmarks/ssr/scenarios/selective-ssr/react/src/routes/__root.tsx, validateSearch: (s) => s as { q?: string } is a type-only cast—malformed q will pass through and won’t trigger the VALIDATE_SEARCH/onError path.
Because q isn’t used anywhere else in src/routes and the same cast appears across other SSR benchmark variants, this is likely intentional; add a short comment explaining that validation is intentionally skipped for benchmark fidelity, or switch to lightweight parsing/coercion if search state should be trustworthy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@benchmarks/ssr/scenarios/selective-ssr/react/src/routes/__root.tsx` around
lines 8 - 11, The validateSearch currently uses a type-only cast
(validateSearch: (s) => s as { q?: string }) which lets malformed q values
bypass VALIDATE_SEARCH/onError; update the implementation so either (1) replace
the cast with a lightweight parser/coercer that extracts and sanitizes q (e.g.,
ensure s.q is a string or undefined) inside the validateSearch function, or (2)
if this lax behavior is intentional for benchmark fidelity, add a concise
comment above the validateSearch entry referencing Route/createRootRoute and
explaining that validation is intentionally skipped for performance measurement
and why it’s acceptable; ensure references to q, VALIDATE_SEARCH/onError, and
src/routes are included in the comment to make the tradeoff explicit.
benchmarks/ssr/scenarios/control-flow/vue/src/routes/__root.tsx (1)

13-13: ⚡ Quick win

Avoid unchecked cast in validateSearch.

validateSearch: (s) => s as { q?: string } asserts shape without validating it. This can type q as string even when query input is not a string.

As per coding guidelines, TypeScript files should maintain extensive type safety and avoid unsafe assertions for externally shaped input.

Suggested change
 export const Route = createRootRoute({
   component: RootComponent,
   notFoundComponent: RootNotFoundComponent,
-  validateSearch: (s) => s as { q?: string },
+  validateSearch: (s: Record<string, unknown>) => ({
+    q: typeof s.q === 'string' ? s.q : undefined,
+  }),
 })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@benchmarks/ssr/scenarios/control-flow/vue/src/routes/__root.tsx` at line 13,
Replace the unchecked cast in validateSearch to perform a runtime shape check:
inside validateSearch(s) ensure s is an object and if s.q exists verify typeof
s.q === "string" before returning { q: s.q }, otherwise return {} (or { q:
undefined }) so the function returns a correctly validated { q?: string }
without using an unsafe as-cast; update the validateSearch implementation
referenced by name to use these typeof/object checks and safe fallback.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@benchmarks/ssr/scenarios/control-flow/react/src/routes/__root.tsx`:
- Around line 8-12: The validateSearch currently just type-asserts and doesn't
normalize or validate q; update the validateSearch callback passed into
createRootRoute (the Route definition) to perform runtime parsing: read s.q, if
it's undefined leave undefined, if it's a string keep it, if it's another
primitive coerce to string (e.g., String(s.q)), and if it's an invalid shape
(object/array) either return { q: undefined } or throw an Error per your route
policy—ensuring the returned value is exactly { q?: string } at runtime rather
than a TypeScript assertion.

In `@benchmarks/ssr/scenarios/control-flow/shared.ts`:
- Around line 62-67: The runNotFoundLoop function omits the iterations option
causing it to use the default 10 and skew results versus the redirect benchmark;
update runNotFoundLoop (which calls runRequestLoop) to pass an explicit
iterations value (e.g., iterations: 100 to match the redirect path) in the
options object alongside seed, buildRequest, and validateResponse so both
control-flow scenarios use the same iteration count.

In `@benchmarks/ssr/scenarios/control-flow/solid/src/routes/__root.tsx`:
- Line 11: The current validateSearch uses an unchecked cast (as { q?: string })
which allows non-string runtime values; update validateSearch to perform runtime
narrowing: ensure the incoming s is a non-null object, check that s.q exists and
is of type string (or coerce/normalize explicitly if desired), and return { q }
only when it's a string (otherwise return {} or { q: undefined }). Locate the
validateSearch arrow in __root.tsx and replace the cast with these runtime
checks so downstream code receives a properly narrowed { q?: string } shape.

In `@benchmarks/ssr/scenarios/head/solid/src/routes/__root.tsx`:
- Line 20: The validateSearch property currently performs a type cast
(validateSearch: (s) => s as { q?: string }) which skips runtime checks; replace
it with a real parser that narrows and sanitizes input in the validateSearch
function (e.g., accept any, check that s is an object, verify s.q is either
undefined or a string, coerce or return undefined for non-strings, or
throw/return a validation error), and return a correctly typed { q?: string }
result so invalid runtime values cannot leak into typed code.

In `@benchmarks/ssr/scenarios/head/vue/src/routes/__root.tsx`:
- Line 22: The current unchecked cast in validateSearch should be replaced with
a runtime check that ensures q is a string (or undefined) instead of blindly
casting; update validateSearch to inspect the incoming s (and handle array
values if possible), e.g. return { q: typeof s?.q === "string" ? s.q : undefined
} (or if s.q can be an array use Array.isArray to pick the first string
element), thereby removing the unsafe `s as { q?: string }` cast and returning a
properly validated { q?: string } result.

In `@benchmarks/ssr/scenarios/loaders/react/src/routes/__root.tsx`:
- Around line 10-13: The validateSearch function currently treats page only as a
number and therefore drops string query values like "?page=2"; update
validateSearch (in __root.tsx) to accept numeric strings too by checking for
typeof s.page === 'number' OR typeof s.page === 'string' and parsing it (e.g.,
parseInt/Number with an isNaN fallback to 0), and leave tags handling as-is
(Array.isArray(s.tags) ? s.tags as string[] : []); ensure parsed page is a safe
integer fallback to 0 when parsing fails.

In `@benchmarks/ssr/scenarios/loaders/solid/src/routes/__root.tsx`:
- Around line 10-13: The validateSearch function currently only accepts numbers
for s.page and thus ignores numeric query strings; update validateSearch (the
function named validateSearch) to coerce string numeric inputs to numbers (e.g.,
use Number(...) or parseInt(...) on s.page) and fall back to 0 when the result
is NaN or not provided, while keeping tags handling the same.

In `@benchmarks/ssr/scenarios/loaders/vue/src/routes/__root.tsx`:
- Around line 12-15: The validateSearch implementation loses numeric string
inputs and unsafely casts tags; update validateSearch to coerce page from
number-like inputs by accepting numbers or numeric strings (parse/Number and
validate isFinite) and default only if invalid, and for tags keep
Array.isArray(s.tags) but filter and map to ensure each element is a string
(e.g., filter by typeof === 'string') before returning []; refer to the
validateSearch function in __root.tsx and replace the current simple typeof/cast
logic with these validated coercions to preserve strict type safety.

In `@benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/__root.tsx`:
- Line 10: The validateSearch implementation in __root.tsx currently only casts
(validateSearch: (s) => s as { q?: string }) which provides no runtime checks;
replace this with a real runtime validator that either uses a schema adapter
(e.g., Zod or Valibot) or an explicit guard that coerces/validates the q field
to string|undefined and throws on malformed input so the router won't pass
invalid values to useSearch(); locate the validateSearch export in the root
route and implement validation/coercion there (or wire a Zod/Valibot schema) to
ensure q is a string if present.

In `@benchmarks/ssr/scenarios/server-fns/react/src/fns.ts`:
- Around line 15-19: The current validation only checks that p?.nested?.list is
an array but not the item types; update the check inside the validator (the
block referencing p?.q, p?.n, and p?.nested?.list) to also ensure every element
in p?.nested?.list is a string (e.g., use Array.isArray(p?.nested?.list) &&
p.nested.list.every(item => typeof item === 'string')) so the runtime shape
matches the Payload expectation used by echo; keep the existing guards for p?.q
and p?.n and fail/return early if any item is not a string.

In `@benchmarks/ssr/scenarios/server-fns/solid/src/fns.ts`:
- Around line 15-19: The runtime validator in validate (the payload checker)
currently only verifies Array.isArray(p?.nested?.list) but not element types;
update the condition to ensure p?.nested?.list is an array of strings (e.g.
Array.isArray(p?.nested?.list) && p.nested.list.every(item => typeof item ===
'string')) so the validator enforces Payload's Array<string> for nested.list;
adjust the if condition that checks typeof p?.q, typeof p?.n and
!Array.isArray(p?.nested?.list) to include the element-type check for
p.nested.list.

In `@benchmarks/ssr/scenarios/server-fns/vue/src/fns.ts`:
- Around line 15-24: The current payload validation only ensures p.q is a
string, p.n is typeof 'number' (which permits NaN/Infinity), and p.nested.list
is an array; strengthen it by validating Number.isFinite(p.n) (or isFinite) to
reject NaN/Infinity and by checking p.nested.list.every(item => typeof item ===
'string') to ensure all list items are strings; update the guard that throws
'invalid payload' (the checks around p?.q, p?.n, p?.nested?.list and the return
of p) to use these stricter conditions so the returned Payload matches its
declared contract.

In `@benchmarks/ssr/scenarios/server-fns/vue/src/routeTree.gen.ts`:
- Around line 79-85: The generated import in routeTree.gen.ts uses a .tsx
extension which triggers TS5097; update the import to drop the extension (change
import type { getRouter } from './router.tsx' to import type { getRouter } from
'./router') or alternatively enable allowImportingTsExtensions in the benchmark
tsconfig chain; locate the declarations around getRouter and createStart in
benchmarks/ssr/scenarios/server-fns/vue/src/routeTree.gen.ts and either remove
the .tsx suffix from the import specifier or add
compilerOptions.allowImportingTsExtensions: true to the appropriate tsconfig so
TypeScript no longer errors on the .tsx import.

In `@benchmarks/ssr/scenarios/streaming/react/src/routes/__root.tsx`:
- Around line 8-11: The current validateSearch uses an assertion (s as { q?:
string }) which skips runtime narrowing; update the Route/createRootRoute
validateSearch to accept s: Record<string, unknown> and perform a runtime check
to return a properly typed { q?: string } object (e.g., check typeof (s as
any).q === 'string' and only then include q, otherwise return {} or undefined).
Modify the validateSearch implementation (in the Route definition that
references RootComponent) to perform that explicit narrowing instead of a type
assertion so strict typing works across root routes.

In `@benchmarks/ssr/scenarios/streaming/vue/src/routes/__root.tsx`:
- Line 12: The validateSearch property currently uses an unchecked TypeScript
cast (validateSearch: (s) => s as { q?: string }) which skips runtime
validation; replace it with a runtime coercion function for safety: change
validateSearch to accept s: Record<string, unknown> and return a plain object {
q?: string } where q is set only if typeof s.q === 'string', otherwise
undefined, mirroring the pattern used in other routes to avoid unsafe
assertions.

In `@benchmarks/ssr/scenarios/streaming/vue/src/routes/stream`.$id.tsx:
- Around line 13-23: Remove the duplicated static fallback paragraphs that
render alongside the Suspense fallbacks: delete the top-level
<p>loading-small</p> (and the analogous <p>loading-big</p> in the later block)
so only the Suspense fallback is emitted while data.value.slowSmall /
data.value.slowBig are pending; locate the Suspense + Await blocks in
stream.$id.tsx (the Await components using promise={data.value.slowSmall} and
promise={data.value.slowBig} with children props) and keep their fallback
functions, removing the extra static <p> nodes that caused double "loading-*"
output.

---

Nitpick comments:
In `@benchmarks/ssr/scenarios/control-flow/vue/src/routes/__root.tsx`:
- Line 13: Replace the unchecked cast in validateSearch to perform a runtime
shape check: inside validateSearch(s) ensure s is an object and if s.q exists
verify typeof s.q === "string" before returning { q: s.q }, otherwise return {}
(or { q: undefined }) so the function returns a correctly validated { q?: string
} without using an unsafe as-cast; update the validateSearch implementation
referenced by name to use these typeof/object checks and safe fallback.

In `@benchmarks/ssr/scenarios/selective-ssr/react/src/routes/__root.tsx`:
- Around line 8-11: The validateSearch currently uses a type-only cast
(validateSearch: (s) => s as { q?: string }) which lets malformed q values
bypass VALIDATE_SEARCH/onError; update the implementation so either (1) replace
the cast with a lightweight parser/coercer that extracts and sanitizes q (e.g.,
ensure s.q is a string or undefined) inside the validateSearch function, or (2)
if this lax behavior is intentional for benchmark fidelity, add a concise
comment above the validateSearch entry referencing Route/createRootRoute and
explaining that validation is intentionally skipped for performance measurement
and why it’s acceptable; ensure references to q, VALIDATE_SEARCH/onError, and
src/routes are included in the comment to make the tradeoff explicit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 91130b74-ac3b-48fc-adcd-dbda85c6d955

📥 Commits

Reviewing files that changed from the base of the PR and between 96eca43 and d953e03.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (255)
  • benchmarks/ssr/README.md
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/react/project.json
  • benchmarks/ssr/scenarios/control-flow/react/project.json
  • benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/react/src/router.tsx
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/from.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/index.tsx
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/missing.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/target.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/react/tsconfig.json
  • benchmarks/ssr/scenarios/control-flow/react/vite.config.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/control-flow/solid/project.json
  • benchmarks/ssr/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/solid/src/router.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/from.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/index.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/missing.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/target.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/tsconfig.json
  • benchmarks/ssr/scenarios/control-flow/solid/vite.config.ts
  • benchmarks/ssr/scenarios/control-flow/vue/project.json
  • benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/vue/src/router.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/from.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/index.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/missing.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/target.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/tsconfig.json
  • benchmarks/ssr/scenarios/control-flow/vue/vite.config.ts
  • benchmarks/ssr/scenarios/head/react/project.json
  • benchmarks/ssr/scenarios/head/react/speed.bench.ts
  • benchmarks/ssr/scenarios/head/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/head/react/src/router.tsx
  • benchmarks/ssr/scenarios/head/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/head/react/src/routes/h.$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/head/react/src/routes/h.$a.$b.tsx
  • benchmarks/ssr/scenarios/head/react/src/routes/h.$a.tsx
  • benchmarks/ssr/scenarios/head/react/tsconfig.json
  • benchmarks/ssr/scenarios/head/react/vite.config.ts
  • benchmarks/ssr/scenarios/head/shared.ts
  • benchmarks/ssr/scenarios/head/solid/project.json
  • benchmarks/ssr/scenarios/head/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/head/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/head/solid/src/router.tsx
  • benchmarks/ssr/scenarios/head/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.$b.tsx
  • benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.tsx
  • benchmarks/ssr/scenarios/head/solid/tsconfig.json
  • benchmarks/ssr/scenarios/head/solid/vite.config.ts
  • benchmarks/ssr/scenarios/head/vue/project.json
  • benchmarks/ssr/scenarios/head/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/head/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/head/vue/src/router.tsx
  • benchmarks/ssr/scenarios/head/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.$b.tsx
  • benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.tsx
  • benchmarks/ssr/scenarios/head/vue/tsconfig.json
  • benchmarks/ssr/scenarios/head/vue/vite.config.ts
  • benchmarks/ssr/scenarios/loaders/react/project.json
  • benchmarks/ssr/scenarios/loaders/react/speed.bench.ts
  • benchmarks/ssr/scenarios/loaders/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/loaders/react/src/router.tsx
  • benchmarks/ssr/scenarios/loaders/react/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/loaders/react/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/loaders/react/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/loaders/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/loaders/react/tsconfig.json
  • benchmarks/ssr/scenarios/loaders/react/vite.config.ts
  • benchmarks/ssr/scenarios/loaders/shared-bench.ts
  • benchmarks/ssr/scenarios/loaders/shared-data.ts
  • benchmarks/ssr/scenarios/loaders/solid/project.json
  • benchmarks/ssr/scenarios/loaders/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/loaders/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/loaders/solid/src/router.tsx
  • benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/loaders/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/loaders/solid/tsconfig.json
  • benchmarks/ssr/scenarios/loaders/solid/vite.config.ts
  • benchmarks/ssr/scenarios/loaders/vue/project.json
  • benchmarks/ssr/scenarios/loaders/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/loaders/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/loaders/vue/src/router.tsx
  • benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/loaders/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/loaders/vue/tsconfig.json
  • benchmarks/ssr/scenarios/loaders/vue/vite.config.ts
  • benchmarks/ssr/scenarios/selective-ssr/react/project.json
  • benchmarks/ssr/scenarios/selective-ssr/react/speed.bench.ts
  • benchmarks/ssr/scenarios/selective-ssr/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/selective-ssr/react/src/router.tsx
  • benchmarks/ssr/scenarios/selective-ssr/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.$b.tsx
  • benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.tsx
  • benchmarks/ssr/scenarios/selective-ssr/react/tsconfig.json
  • benchmarks/ssr/scenarios/selective-ssr/react/vite.config.ts
  • benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts
  • benchmarks/ssr/scenarios/selective-ssr/solid/project.json
  • benchmarks/ssr/scenarios/selective-ssr/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/selective-ssr/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/selective-ssr/solid/src/router.tsx
  • benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.$b.tsx
  • benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.tsx
  • benchmarks/ssr/scenarios/selective-ssr/solid/tsconfig.json
  • benchmarks/ssr/scenarios/selective-ssr/solid/vite.config.ts
  • benchmarks/ssr/scenarios/selective-ssr/vue/project.json
  • benchmarks/ssr/scenarios/selective-ssr/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/selective-ssr/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/selective-ssr/vue/src/router.tsx
  • benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.$b.tsx
  • benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.tsx
  • benchmarks/ssr/scenarios/selective-ssr/vue/tsconfig.json
  • benchmarks/ssr/scenarios/selective-ssr/vue/vite.config.ts
  • benchmarks/ssr/scenarios/server-fns/bench.ts
  • benchmarks/ssr/scenarios/server-fns/react/project.json
  • benchmarks/ssr/scenarios/server-fns/react/speed.bench.ts
  • benchmarks/ssr/scenarios/server-fns/react/src/fns.ts
  • benchmarks/ssr/scenarios/server-fns/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/server-fns/react/src/router.tsx
  • benchmarks/ssr/scenarios/server-fns/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/server-fns/react/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/server-fns/react/src/routes/index.tsx
  • benchmarks/ssr/scenarios/server-fns/react/tsconfig.json
  • benchmarks/ssr/scenarios/server-fns/react/vite.config.ts
  • benchmarks/ssr/scenarios/server-fns/solid/project.json
  • benchmarks/ssr/scenarios/server-fns/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/server-fns/solid/src/fns.ts
  • benchmarks/ssr/scenarios/server-fns/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/server-fns/solid/src/router.tsx
  • benchmarks/ssr/scenarios/server-fns/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/server-fns/solid/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/server-fns/solid/src/routes/index.tsx
  • benchmarks/ssr/scenarios/server-fns/solid/tsconfig.json
  • benchmarks/ssr/scenarios/server-fns/solid/vite.config.ts
  • benchmarks/ssr/scenarios/server-fns/vue/project.json
  • benchmarks/ssr/scenarios/server-fns/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/server-fns/vue/src/fns.ts
  • benchmarks/ssr/scenarios/server-fns/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/server-fns/vue/src/router.tsx
  • benchmarks/ssr/scenarios/server-fns/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/server-fns/vue/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/server-fns/vue/src/routes/index.tsx
  • benchmarks/ssr/scenarios/server-fns/vue/tsconfig.json
  • benchmarks/ssr/scenarios/server-fns/vue/vite.config.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/react/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/react/speed.bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/react/src/middleware.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/react/src/router.tsx
  • benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/api.chain.$id.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/index.tsx
  • benchmarks/ssr/scenarios/server-routes-middleware/react/tsconfig.json
  • benchmarks/ssr/scenarios/server-routes-middleware/react/vite.config.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/shared.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/src/middleware.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/src/router.tsx
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/api.chain.$id.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/index.tsx
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/tsconfig.json
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/vite.config.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/src/middleware.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/src/router.tsx
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/api.chain.$id.ts
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/index.tsx
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/tsconfig.json
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/vite.config.ts
  • benchmarks/ssr/scenarios/server-routes/react/project.json
  • benchmarks/ssr/scenarios/server-routes/react/speed.bench.ts
  • benchmarks/ssr/scenarios/server-routes/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/server-routes/react/src/router.tsx
  • benchmarks/ssr/scenarios/server-routes/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/server-routes/react/src/routes/api.users.$id.ts
  • benchmarks/ssr/scenarios/server-routes/react/src/routes/index.tsx
  • benchmarks/ssr/scenarios/server-routes/react/tsconfig.json
  • benchmarks/ssr/scenarios/server-routes/react/vite.config.ts
  • benchmarks/ssr/scenarios/server-routes/shared.ts
  • benchmarks/ssr/scenarios/server-routes/solid/project.json
  • benchmarks/ssr/scenarios/server-routes/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/server-routes/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/server-routes/solid/src/router.tsx
  • benchmarks/ssr/scenarios/server-routes/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/server-routes/solid/src/routes/api.users.$id.ts
  • benchmarks/ssr/scenarios/server-routes/solid/src/routes/index.tsx
  • benchmarks/ssr/scenarios/server-routes/solid/tsconfig.json
  • benchmarks/ssr/scenarios/server-routes/solid/vite.config.ts
  • benchmarks/ssr/scenarios/server-routes/vue/project.json
  • benchmarks/ssr/scenarios/server-routes/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/server-routes/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/server-routes/vue/src/router.tsx
  • benchmarks/ssr/scenarios/server-routes/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/server-routes/vue/src/routes/api.users.$id.ts
  • benchmarks/ssr/scenarios/server-routes/vue/src/routes/index.tsx
  • benchmarks/ssr/scenarios/server-routes/vue/tsconfig.json
  • benchmarks/ssr/scenarios/server-routes/vue/vite.config.ts
  • benchmarks/ssr/scenarios/streaming/react/project.json
  • benchmarks/ssr/scenarios/streaming/react/speed.bench.ts
  • benchmarks/ssr/scenarios/streaming/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/streaming/react/src/router.tsx
  • benchmarks/ssr/scenarios/streaming/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/streaming/react/src/routes/stream.$id.tsx
  • benchmarks/ssr/scenarios/streaming/react/tsconfig.json
  • benchmarks/ssr/scenarios/streaming/react/vite.config.ts
  • benchmarks/ssr/scenarios/streaming/shared-bench.ts
  • benchmarks/ssr/scenarios/streaming/shared-data.ts
  • benchmarks/ssr/scenarios/streaming/solid/project.json
  • benchmarks/ssr/scenarios/streaming/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/streaming/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/streaming/solid/src/router.tsx
  • benchmarks/ssr/scenarios/streaming/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/streaming/solid/src/routes/stream.$id.tsx
  • benchmarks/ssr/scenarios/streaming/solid/tsconfig.json
  • benchmarks/ssr/scenarios/streaming/solid/vite.config.ts
  • benchmarks/ssr/scenarios/streaming/vue/project.json
  • benchmarks/ssr/scenarios/streaming/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/streaming/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/streaming/vue/src/router.tsx
  • benchmarks/ssr/scenarios/streaming/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/streaming/vue/src/routes/stream.$id.tsx
  • benchmarks/ssr/scenarios/streaming/vue/tsconfig.json
  • benchmarks/ssr/scenarios/streaming/vue/vite.config.ts
  • benchmarks/ssr/solid/project.json
  • benchmarks/ssr/vitest.config.ts
  • benchmarks/ssr/vitest.react.config.ts
  • benchmarks/ssr/vitest.solid.config.ts
  • benchmarks/ssr/vitest.vue.config.ts
  • benchmarks/ssr/vue/project.json
  • package.json

Comment thread benchmarks/ssr/scenarios/control-flow/react/src/routes/__root.tsx
Comment thread benchmarks/ssr/scenarios/control-flow/shared.ts
Comment thread benchmarks/ssr/scenarios/control-flow/solid/src/routes/__root.tsx
Comment thread benchmarks/ssr/scenarios/head/solid/src/routes/__root.tsx
Comment thread benchmarks/ssr/scenarios/head/vue/src/routes/__root.tsx
Comment thread benchmarks/ssr/scenarios/server-fns/vue/src/routeTree.gen.ts
Comment thread benchmarks/ssr/scenarios/server-routes/vue/src/routeTree.gen.ts
Comment thread benchmarks/ssr/scenarios/streaming/react/src/routes/__root.tsx
Comment thread benchmarks/ssr/scenarios/streaming/vue/src/routes/__root.tsx
Comment thread benchmarks/ssr/scenarios/streaming/vue/src/routes/stream.$id.tsx
@codspeed-hq

codspeed-hq Bot commented Jun 11, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 6 untouched benchmarks
🆕 90 new benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 ssr dehydrate plain control (vue) N/A 97.8 ms N/A
🆕 ssr not-found (vue) N/A 73.4 ms N/A
🆕 ssr redirect (vue) N/A 69.5 ms N/A
🆕 ssr head (vue) N/A 147 ms N/A
🆕 ssr loaders (vue) N/A 94.3 ms N/A
🆕 ssr selective (vue) N/A 72 ms N/A
🆕 ssr server-fn GET (vue) N/A 75.1 ms N/A
🆕 ssr server-fn POST (vue) N/A 49.6 ms N/A
🆕 ssr server-route middleware (vue) N/A 44.7 ms N/A
🆕 ssr server-route (vue) N/A 33.7 ms N/A
🆕 ssr streaming deferred (vue) N/A 106.8 ms N/A
🆕 ssr assets inline-css cdn (vue) N/A 82.4 ms N/A
🆕 ssr assets linked-css control (vue) N/A 72 ms N/A
🆕 ssr before-load chain (vue) N/A 127.4 ms N/A
🆕 ssr control-flow error 500 (vue) N/A 92.9 ms N/A
🆕 ssr control-flow route headers (vue) N/A 88.6 ms N/A
🆕 ssr control-flow unmatched 404 (vue) N/A 128.4 ms N/A
🆕 ssr global-mw document (vue) N/A 92.5 ms N/A
🆕 ssr global-mw server-fn (vue) N/A 48.8 ms N/A
🆕 ssr global-mw server-route (vue) N/A 29.6 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing benchmark-ssr-scenarios (8524c9e) with main (96eca43)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (6f882b7) during the generation of this report, so 96eca43 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
benchmarks/ssr/scenarios/loaders/react/project.json (1)

15-15: Potential Windows compatibility issue with NODE_ENV=production in benchmark build commands

  • NODE_ENV=production vite build ... uses Unix env-var syntax; cross-env isn’t used in benchmarks/ssr/scenarios/**/project.json (same pattern appears across many SSR scenarios).
  • No Windows CI/runner references or Windows-related docs were found for the SSR benchmarks; if Windows execution is required, switch to cross-env and apply it consistently.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@benchmarks/ssr/scenarios/loaders/react/project.json` at line 15, The build
command string "NODE_ENV=production vite build --config
{projectRoot}/vite.config.ts" in the project.json scenarios uses Unix shell env
syntax which breaks on Windows; update the command to use a cross-platform env
tool (e.g. prefix with "cross-env NODE_ENV=production ...") and ensure
"cross-env" is added to devDependencies if not present, then apply the same
change consistently across all benchmarks/ssr/scenarios/**/project.json files
that contain the same pattern so Windows runners can execute the build.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@benchmarks/ssr/scenarios/loaders/react/project.json`:
- Line 15: The build command string "NODE_ENV=production vite build --config
{projectRoot}/vite.config.ts" in the project.json scenarios uses Unix shell env
syntax which breaks on Windows; update the command to use a cross-platform env
tool (e.g. prefix with "cross-env NODE_ENV=production ...") and ensure
"cross-env" is added to devDependencies if not present, then apply the same
change consistently across all benchmarks/ssr/scenarios/**/project.json files
that contain the same pattern so Windows runners can execute the build.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3d052f57-7948-459f-b10a-7d092de6b431

📥 Commits

Reviewing files that changed from the base of the PR and between d953e03 and bc24859.

📒 Files selected for processing (27)
  • benchmarks/ssr/react/project.json
  • benchmarks/ssr/scenarios/control-flow/react/project.json
  • benchmarks/ssr/scenarios/control-flow/solid/project.json
  • benchmarks/ssr/scenarios/control-flow/vue/project.json
  • benchmarks/ssr/scenarios/head/react/project.json
  • benchmarks/ssr/scenarios/head/solid/project.json
  • benchmarks/ssr/scenarios/head/vue/project.json
  • benchmarks/ssr/scenarios/loaders/react/project.json
  • benchmarks/ssr/scenarios/loaders/solid/project.json
  • benchmarks/ssr/scenarios/loaders/vue/project.json
  • benchmarks/ssr/scenarios/selective-ssr/react/project.json
  • benchmarks/ssr/scenarios/selective-ssr/solid/project.json
  • benchmarks/ssr/scenarios/selective-ssr/vue/project.json
  • benchmarks/ssr/scenarios/server-fns/react/project.json
  • benchmarks/ssr/scenarios/server-fns/solid/project.json
  • benchmarks/ssr/scenarios/server-fns/vue/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/react/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/project.json
  • benchmarks/ssr/scenarios/server-routes/react/project.json
  • benchmarks/ssr/scenarios/server-routes/solid/project.json
  • benchmarks/ssr/scenarios/server-routes/vue/project.json
  • benchmarks/ssr/scenarios/streaming/react/project.json
  • benchmarks/ssr/scenarios/streaming/solid/project.json
  • benchmarks/ssr/scenarios/streaming/vue/project.json
  • benchmarks/ssr/solid/project.json
  • benchmarks/ssr/vue/project.json
✅ Files skipped from review due to trivial changes (6)
  • benchmarks/ssr/scenarios/server-routes-middleware/react/project.json
  • benchmarks/ssr/scenarios/server-routes/vue/project.json
  • benchmarks/ssr/scenarios/head/react/project.json
  • benchmarks/ssr/vue/project.json
  • benchmarks/ssr/scenarios/selective-ssr/react/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/project.json
🚧 Files skipped from review as they are similar to previous changes (20)
  • benchmarks/ssr/scenarios/server-fns/react/project.json
  • benchmarks/ssr/scenarios/streaming/react/project.json
  • benchmarks/ssr/scenarios/server-fns/solid/project.json
  • benchmarks/ssr/scenarios/selective-ssr/solid/project.json
  • benchmarks/ssr/scenarios/loaders/solid/project.json
  • benchmarks/ssr/scenarios/loaders/vue/project.json
  • benchmarks/ssr/scenarios/control-flow/vue/project.json
  • benchmarks/ssr/scenarios/streaming/solid/project.json
  • benchmarks/ssr/scenarios/streaming/vue/project.json
  • benchmarks/ssr/scenarios/selective-ssr/vue/project.json
  • benchmarks/ssr/scenarios/server-fns/vue/project.json
  • benchmarks/ssr/scenarios/head/solid/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/project.json
  • benchmarks/ssr/react/project.json
  • benchmarks/ssr/scenarios/head/vue/project.json
  • benchmarks/ssr/scenarios/server-routes/solid/project.json
  • benchmarks/ssr/scenarios/control-flow/react/project.json
  • benchmarks/ssr/solid/project.json
  • benchmarks/ssr/scenarios/control-flow/solid/project.json
  • benchmarks/ssr/scenarios/server-routes/react/project.json

@Sheraff Sheraff requested a review from a team as a code owner June 12, 2026 10:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@nx.json`:
- Around line 68-71: Add the missing upstream dependency for the test:types:ssr
target by adding a dependsOn entry matching other type-test targets (e.g., the
same dependsOn used by test:types), so SSR type tests require the upstream
build/production tasks before running; update the test:types:ssr target (symbol
"test:types:ssr") to include the appropriate "dependsOn" array (for example the
same value as "test:types") to enforce the required upstream build dependency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b0fc7fd1-9b61-4e5e-ba1c-b42151142238

📥 Commits

Reviewing files that changed from the base of the PR and between 32909ef and 7924f1d.

📒 Files selected for processing (29)
  • benchmarks/ssr/package.json
  • benchmarks/ssr/react/project.json
  • benchmarks/ssr/scenarios/control-flow/react/project.json
  • benchmarks/ssr/scenarios/control-flow/solid/project.json
  • benchmarks/ssr/scenarios/control-flow/vue/project.json
  • benchmarks/ssr/scenarios/head/react/project.json
  • benchmarks/ssr/scenarios/head/solid/project.json
  • benchmarks/ssr/scenarios/head/vue/project.json
  • benchmarks/ssr/scenarios/loaders/react/project.json
  • benchmarks/ssr/scenarios/loaders/solid/project.json
  • benchmarks/ssr/scenarios/loaders/vue/project.json
  • benchmarks/ssr/scenarios/selective-ssr/react/project.json
  • benchmarks/ssr/scenarios/selective-ssr/solid/project.json
  • benchmarks/ssr/scenarios/selective-ssr/vue/project.json
  • benchmarks/ssr/scenarios/server-fns/react/project.json
  • benchmarks/ssr/scenarios/server-fns/solid/project.json
  • benchmarks/ssr/scenarios/server-fns/vue/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/react/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/project.json
  • benchmarks/ssr/scenarios/server-routes/react/project.json
  • benchmarks/ssr/scenarios/server-routes/solid/project.json
  • benchmarks/ssr/scenarios/server-routes/vue/project.json
  • benchmarks/ssr/scenarios/streaming/react/project.json
  • benchmarks/ssr/scenarios/streaming/solid/project.json
  • benchmarks/ssr/scenarios/streaming/vue/project.json
  • benchmarks/ssr/solid/project.json
  • benchmarks/ssr/vue/project.json
  • nx.json
💤 Files with no reviewable changes (28)
  • benchmarks/ssr/scenarios/loaders/react/project.json
  • benchmarks/ssr/scenarios/head/react/project.json
  • benchmarks/ssr/scenarios/streaming/vue/project.json
  • benchmarks/ssr/solid/project.json
  • benchmarks/ssr/scenarios/control-flow/vue/project.json
  • benchmarks/ssr/scenarios/head/vue/project.json
  • benchmarks/ssr/scenarios/loaders/solid/project.json
  • benchmarks/ssr/scenarios/streaming/react/project.json
  • benchmarks/ssr/vue/project.json
  • benchmarks/ssr/scenarios/server-routes/react/project.json
  • benchmarks/ssr/scenarios/server-routes/vue/project.json
  • benchmarks/ssr/scenarios/loaders/vue/project.json
  • benchmarks/ssr/scenarios/control-flow/react/project.json
  • benchmarks/ssr/scenarios/selective-ssr/react/project.json
  • benchmarks/ssr/scenarios/server-fns/vue/project.json
  • benchmarks/ssr/scenarios/control-flow/solid/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/solid/project.json
  • benchmarks/ssr/scenarios/selective-ssr/solid/project.json
  • benchmarks/ssr/scenarios/server-fns/react/project.json
  • benchmarks/ssr/scenarios/server-routes/solid/project.json
  • benchmarks/ssr/scenarios/server-fns/solid/project.json
  • benchmarks/ssr/scenarios/streaming/solid/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/vue/project.json
  • benchmarks/ssr/scenarios/selective-ssr/vue/project.json
  • benchmarks/ssr/scenarios/server-routes-middleware/react/project.json
  • benchmarks/ssr/react/project.json
  • benchmarks/ssr/scenarios/head/solid/project.json
  • benchmarks/ssr/package.json

Comment thread nx.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (1)
benchmarks/ssr/scenarios/serialization/solid/src/routes/rich.$id.tsx (1)

12-12: ⚡ Quick win

Remove the shared Array.from(...)[0] allocation from both rich-serialization benchmarks.

benchmarks/ssr/scenarios/serialization/solid/src/routes/rich.$id.tsx and benchmarks/ssr/scenarios/serialization/react/src/routes/rich.$id.tsx both materialize the entire Set just to read its first item. Because these files are part of the SSR benchmark suite, that repeated allocation pollutes the measured render cost in both scenarios. Switching both sites to tags.values().next().value keeps the scenario behavior the same without adding per-request array creation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@benchmarks/ssr/scenarios/serialization/solid/src/routes/rich`.$id.tsx at line
12, The helper function firstTag currently does Array.from(data().tags)[0],
which allocates a new array; change it to return
data().tags.values().next().value to avoid materializing the whole Set (i.e.,
replace Array.from(data().tags)[0] with data().tags.values().next().value in the
firstTag implementation), preserving behavior for empty sets (it will yield
undefined) and avoiding the per-request allocation in the SSR benchmark.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@benchmarks/ssr/bench-utils.ts`:
- Around line 113-120: The current pendingBodyReads logic pushes
response.text().then(... validateBody ...) and awaits
Promise.all(pendingBodyReads) which fails fast and leaves other response.text()
reads running; update the drain to use Promise.allSettled(pendingBodyReads),
collect any rejection from the validateBody handlers (or response.text()) and
after allSettled completes rethrow the first error (or aggregate) so all body
reads finish before the benchmark exits; locate the pendingBodyReads array usage
and the final await Promise.all(...) and replace with Promise.allSettled(...) +
rethrow handling.

In `@benchmarks/ssr/scenarios/assets/shared.ts`:
- Around line 69-80: The linked-control sanity check must assert exclusivity of
linked CSS (not just presence); in the block that fetches via handler.fetch and
checks linkedResponse/linkedBody/linkedLinkHeader, add an assertion that
linkedBody does NOT contain inline style tags (e.g., verify linkedBody does not
contain '<style') so the test fails if both inline <style> and linked styles are
emitted, ensuring the control benchmark measures the non-inline path
exclusively.

In `@benchmarks/ssr/scenarios/assets/vue/src/server.ts`:
- Around line 21-28: The createTransform implementation in transformAssets
(function createTransform, context type CreateTransformContext) currently uses
the raw x-assets-cdn header as the prefix passed into createCdnTransform
(falling back to cdnOrigin), which lets clients choose arbitrary CDN origins;
change this to validate/match the header value against a small allowlist of
known CDN host keys (e.g., a Map or object mapping short header tokens to
concrete origins) and only use the mapped origin when there's an exact match,
otherwise fall back to cdnOrigin; update both
benchmarks/ssr/scenarios/assets/vue/src/server.ts and
benchmarks/ssr/scenarios/assets/solid/src/server.ts to perform this mapping
before calling createCdnTransform and keep the warmup branch using cdnOrigin as
before.

In `@benchmarks/ssr/scenarios/global-middleware/react/src/fns.ts`:
- Around line 6-18: The validate function currently only checks that
payload?.nested?.list is an array but not that its elements are strings; update
validate (in the function named validate that returns Payload) to assert each
element of payload.nested.list is a string (e.g., iterate with
Array.prototype.every or a simple loop) and throw a clear Error('invalid
payload: nested.list must be an array of strings') when any element fails,
ensuring the returned Payload.nested.list is indeed Array<string>.

In `@benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.ping`.$id.ts:
- Around line 10-18: The GET handler currently coerces an undefined context into
{} and casts it to GlobalMiddlewareContext, hiding wiring bugs; update the GET:
({ params, context }) => { ... } handler to validate that context is present and
has the expected fields (e.g., requestTrace and requestTotal) before casting to
GlobalMiddlewareContext, and if the validation fails return an error response
(or throw) instead of proceeding to call makeServerRouteMarker(params.id,
middlewareContext) and returning a 200 payload; ensure the check uses the
GlobalMiddlewareContext shape and short-circuits early to fail fast when
middleware context is missing or malformed.

In `@benchmarks/ssr/scenarios/rewrites/react/src/router.tsx`:
- Line 4: The localePrefixRe currently requires a trailing path segment and thus
misses locale-only inputs like "/fr"; update the regex literal localePrefixRe to
accept an optional trailing slash/segment (e.g., change to
/^\/(fr|de|es)(\/.*)?$/) so both "/fr" and "/fr/..." match, and apply the same
adjustment to the other occurrences around lines 16-19 that rely on this
pattern.

In `@benchmarks/ssr/scenarios/rewrites/vue/src/router.tsx`:
- Around line 4-22: The input rewrite in getRouter currently uses localePrefixRe
which requires a trailing path segment so URLs like "/fr" don't match; update
the input rewrite to accept locale-only paths by changing the match logic
(either the regex localePrefixRe to allow an optional group, e.g. make the
second capture optional, or after matching handle when match[2] is undefined)
and when a locale-only path is detected set url.pathname to "/" (not empty) and
set the "_locale" searchParam to the matched locale; ensure this change is
applied inside the input function in getRouter so it mirrors the output rewrite
behavior.

In `@benchmarks/ssr/scenarios/serialization/shared-bench.ts`:
- Around line 74-78: The plain-path assertions in shared-bench.ts forget to
assert that the rich date payload is absent; add an exclusion for the
richDateIso value so a rich-date leak into /plain will fail. Specifically, in
the block using assertIncludes/assertExcludes (around the plain-body checks) add
an assertExcludes(plainBody, richDateIso, 'plain') next to the other plain
assertions (the ones calling assertIncludes/assertExcludes) to ensure
richDateIso is not present in the plain response.

---

Nitpick comments:
In `@benchmarks/ssr/scenarios/serialization/solid/src/routes/rich`.$id.tsx:
- Line 12: The helper function firstTag currently does
Array.from(data().tags)[0], which allocates a new array; change it to return
data().tags.values().next().value to avoid materializing the whole Set (i.e.,
replace Array.from(data().tags)[0] with data().tags.values().next().value in the
firstTag implementation), preserving behavior for empty sets (it will yield
undefined) and avoiding the per-request allocation in the SSR benchmark.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7c0aadfa-8286-42a1-a66a-5b30b667efc0

📥 Commits

Reviewing files that changed from the base of the PR and between 7924f1d and 111ca45.

📒 Files selected for processing (178)
  • benchmarks/ssr/README.md
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/react/project.json
  • benchmarks/ssr/scenarios/assets/react/speed.bench.ts
  • benchmarks/ssr/scenarios/assets/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/react/src/router.tsx
  • benchmarks/ssr/scenarios/assets/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.$y.tsx
  • benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.tsx
  • benchmarks/ssr/scenarios/assets/react/src/server.ts
  • benchmarks/ssr/scenarios/assets/react/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/assets/react/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/assets/react/tsconfig.json
  • benchmarks/ssr/scenarios/assets/react/vite.config.ts
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/assets/solid/project.json
  • benchmarks/ssr/scenarios/assets/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/assets/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/solid/src/router.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.$y.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/server.ts
  • benchmarks/ssr/scenarios/assets/solid/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/assets/solid/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/assets/solid/tsconfig.json
  • benchmarks/ssr/scenarios/assets/solid/vite.config.ts
  • benchmarks/ssr/scenarios/assets/vue/project.json
  • benchmarks/ssr/scenarios/assets/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/assets/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/vue/src/router.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.$y.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/server.ts
  • benchmarks/ssr/scenarios/assets/vue/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/assets/vue/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/assets/vue/tsconfig.json
  • benchmarks/ssr/scenarios/assets/vue/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/react/project.json
  • benchmarks/ssr/scenarios/before-load/react/speed.bench.ts
  • benchmarks/ssr/scenarios/before-load/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/react/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/before-load/react/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/react/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/before-load/shared.ts
  • benchmarks/ssr/scenarios/before-load/solid/project.json
  • benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/before-load/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/solid/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/before-load/solid/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/solid/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/vue/project.json
  • benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/before-load/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/vue/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/before-load/vue/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/vue/vite.config.ts
  • benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/global-middleware/react/project.json
  • benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/fns.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.ping.$id.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/index.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/page.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/start.ts
  • benchmarks/ssr/scenarios/global-middleware/react/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/react/vite.config.ts
  • benchmarks/ssr/scenarios/global-middleware/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/project.json
  • benchmarks/ssr/scenarios/global-middleware/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/fns.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.ping.$id.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/index.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/page.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/start.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/solid/vite.config.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/project.json
  • benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/fns.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.ping.$id.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/index.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/page.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/start.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/vue/vite.config.ts
  • benchmarks/ssr/scenarios/rewrites/react/project.json
  • benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/ssr/scenarios/rewrites/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/react/src/router.tsx
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.tsx
  • benchmarks/ssr/scenarios/rewrites/react/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/react/vite.config.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/rewrites/solid/project.json
  • benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/rewrites/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/solid/src/router.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/solid/vite.config.ts
  • benchmarks/ssr/scenarios/rewrites/vue/project.json
  • benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/rewrites/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/vue/src/router.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/vue/vite.config.ts
  • benchmarks/ssr/scenarios/serialization/react/project.json
  • benchmarks/ssr/scenarios/serialization/react/speed.bench.ts
  • benchmarks/ssr/scenarios/serialization/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/serialization/react/src/router.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/routes/plain.$id.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/routes/rich.$id.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/serialization.ts
  • benchmarks/ssr/scenarios/serialization/react/src/start.tsx
  • benchmarks/ssr/scenarios/serialization/react/tsconfig.json
  • benchmarks/ssr/scenarios/serialization/react/vite.config.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-data.ts
  • benchmarks/ssr/scenarios/serialization/solid/project.json
  • benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/router.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/routes/plain.$id.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/routes/rich.$id.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/serialization.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/start.tsx
  • benchmarks/ssr/scenarios/serialization/solid/tsconfig.json
  • benchmarks/ssr/scenarios/serialization/solid/vite.config.ts
✅ Files skipped from review due to trivial changes (74)
  • benchmarks/ssr/scenarios/assets/vue/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/before-load/react/speed.bench.ts
  • benchmarks/ssr/scenarios/assets/react/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/assets/react/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/solid/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/before-load/vue/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/assets/react/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/vue/src/router.tsx
  • benchmarks/ssr/scenarios/serialization/solid/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/router.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.tsx
  • benchmarks/ssr/scenarios/assets/vue/project.json
  • benchmarks/ssr/scenarios/rewrites/react/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/solid/project.json
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/router.tsx
  • benchmarks/ssr/scenarios/serialization/react/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/react/src/router.tsx
  • benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/index.tsx
  • benchmarks/ssr/scenarios/before-load/vue/vite.config.ts
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/before-load/vue/project.json
  • benchmarks/ssr/scenarios/before-load/react/vite.config.ts
  • benchmarks/ssr/scenarios/serialization/solid/project.json
  • benchmarks/ssr/scenarios/rewrites/vue/project.json
  • benchmarks/ssr/scenarios/global-middleware/vue/project.json
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/index.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/start.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/vite.config.ts
  • benchmarks/ssr/scenarios/assets/solid/src/router.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/router.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/router.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/before-load/shared.ts
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/react/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/index.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/react/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/vue/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/serialization/shared-data.ts
  • benchmarks/ssr/scenarios/before-load/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/serialization/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/react/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/assets/solid/tsconfig.json
  • benchmarks/ssr/scenarios/serialization/react/src/router.tsx

Comment thread benchmarks/ssr/bench-utils.ts
Comment thread benchmarks/ssr/scenarios/assets/shared.ts
Comment thread benchmarks/ssr/scenarios/assets/vue/src/server.ts
Comment thread benchmarks/ssr/scenarios/global-middleware/react/src/fns.ts
Comment thread benchmarks/ssr/scenarios/rewrites/react/src/router.tsx
Comment thread benchmarks/ssr/scenarios/rewrites/vue/src/router.tsx
Comment thread benchmarks/ssr/scenarios/serialization/shared-bench.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@benchmarks/ssr/scenarios/before-load/vue/src/routes/`$a.$b.$c.tsx:
- Around line 5-15: The current casts to BeforeLoadContext in beforeLoad and
loader are unsafe because BeforeLoadContext.chainToken is optional; replace the
direct casts with a runtime narrowing guard that checks typeof
context?.chainToken === "string" before using it (e.g., in beforeLoad when
building chainToken and ctxC, and in loader before calling
makeBeforeLoadMarker). If the guard fails, handle the missing chainToken
explicitly (throw a descriptive error or return a safe default) rather than
relying on the cast so makeBeforeLoadMarker always receives a valid chainToken.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 04167deb-4ca4-4234-b2e5-652b5d41acc5

📥 Commits

Reviewing files that changed from the base of the PR and between 7924f1d and 410d2f4.

📒 Files selected for processing (178)
  • benchmarks/ssr/README.md
  • benchmarks/ssr/bench-utils.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/assets/react/project.json
  • benchmarks/ssr/scenarios/assets/react/speed.bench.ts
  • benchmarks/ssr/scenarios/assets/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/react/src/router.tsx
  • benchmarks/ssr/scenarios/assets/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.$y.tsx
  • benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.tsx
  • benchmarks/ssr/scenarios/assets/react/src/server.ts
  • benchmarks/ssr/scenarios/assets/react/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/assets/react/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/assets/react/tsconfig.json
  • benchmarks/ssr/scenarios/assets/react/vite.config.ts
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/assets/solid/project.json
  • benchmarks/ssr/scenarios/assets/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/assets/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/solid/src/router.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.$y.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/server.ts
  • benchmarks/ssr/scenarios/assets/solid/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/assets/solid/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/assets/solid/tsconfig.json
  • benchmarks/ssr/scenarios/assets/solid/vite.config.ts
  • benchmarks/ssr/scenarios/assets/vue/project.json
  • benchmarks/ssr/scenarios/assets/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/assets/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/vue/src/router.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.$y.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/server.ts
  • benchmarks/ssr/scenarios/assets/vue/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/assets/vue/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/assets/vue/tsconfig.json
  • benchmarks/ssr/scenarios/assets/vue/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/react/project.json
  • benchmarks/ssr/scenarios/before-load/react/speed.bench.ts
  • benchmarks/ssr/scenarios/before-load/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/react/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/before-load/react/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/react/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/before-load/shared.ts
  • benchmarks/ssr/scenarios/before-load/solid/project.json
  • benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/before-load/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/solid/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/before-load/solid/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/solid/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/vue/project.json
  • benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/before-load/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/vue/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/before-load/vue/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/vue/vite.config.ts
  • benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/shared.ts
  • benchmarks/ssr/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/global-middleware/react/project.json
  • benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/fns.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.ping.$id.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/index.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/page.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/start.ts
  • benchmarks/ssr/scenarios/global-middleware/react/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/react/vite.config.ts
  • benchmarks/ssr/scenarios/global-middleware/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/project.json
  • benchmarks/ssr/scenarios/global-middleware/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/fns.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.ping.$id.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/index.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/page.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/start.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/solid/vite.config.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/project.json
  • benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/fns.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.ping.$id.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/index.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/page.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/start.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/vue/vite.config.ts
  • benchmarks/ssr/scenarios/rewrites/react/project.json
  • benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/ssr/scenarios/rewrites/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/react/src/router.tsx
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.tsx
  • benchmarks/ssr/scenarios/rewrites/react/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/react/vite.config.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/rewrites/solid/project.json
  • benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/rewrites/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/solid/src/router.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/solid/vite.config.ts
  • benchmarks/ssr/scenarios/rewrites/vue/project.json
  • benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/rewrites/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/vue/src/router.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/vue/vite.config.ts
  • benchmarks/ssr/scenarios/serialization/react/project.json
  • benchmarks/ssr/scenarios/serialization/react/speed.bench.ts
  • benchmarks/ssr/scenarios/serialization/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/serialization/react/src/router.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/routes/plain.$id.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/routes/rich.$id.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/serialization.ts
  • benchmarks/ssr/scenarios/serialization/react/src/start.tsx
  • benchmarks/ssr/scenarios/serialization/react/tsconfig.json
  • benchmarks/ssr/scenarios/serialization/react/vite.config.ts
  • benchmarks/ssr/scenarios/serialization/shared-bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-data.ts
  • benchmarks/ssr/scenarios/serialization/solid/project.json
  • benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/router.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/routes/plain.$id.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/routes/rich.$id.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/serialization.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/start.tsx
  • benchmarks/ssr/scenarios/serialization/solid/tsconfig.json
  • benchmarks/ssr/scenarios/serialization/solid/vite.config.ts
✅ Files skipped from review due to trivial changes (37)
  • benchmarks/ssr/scenarios/assets/solid/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/assets/solid/tsconfig.json
  • benchmarks/ssr/scenarios/assets/react/project.json
  • benchmarks/ssr/scenarios/before-load/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/tsconfig.json
  • benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/assets/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/router.tsx
  • benchmarks/ssr/scenarios/serialization/react/project.json
  • benchmarks/ssr/scenarios/serialization/react/src/serialization.ts
  • benchmarks/ssr/scenarios/assets/solid/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/assets/vue/tsconfig.json
  • benchmarks/ssr/scenarios/serialization/solid/project.json
  • benchmarks/ssr/scenarios/assets/vue/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/rewrites/react/tsconfig.json
  • benchmarks/ssr/scenarios/global-middleware/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/solid/vite.config.ts
  • benchmarks/ssr/scenarios/assets/solid/project.json
  • benchmarks/ssr/scenarios/assets/react/tsconfig.json
  • benchmarks/ssr/scenarios/assets/react/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/vue/vite.config.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/project.json
  • benchmarks/ssr/scenarios/global-middleware/solid/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/vue/tsconfig.json
  • benchmarks/ssr/scenarios/assets/vue/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/rewrites/vue/tsconfig.json
  • benchmarks/ssr/scenarios/control-flow/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/solid/project.json
  • benchmarks/ssr/scenarios/control-flow/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/serialization/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/before-load/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/solid/src/routeTree.gen.ts
🚧 Files skipped from review as they are similar to previous changes (119)
  • benchmarks/ssr/scenarios/assets/react/src/styles/assets-leaf.css
  • benchmarks/ssr/scenarios/assets/vue/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/page.$id.tsx
  • benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/vue/project.json
  • benchmarks/ssr/scenarios/before-load/react/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/serialization.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.ping.$id.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/start.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/router.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/project.json
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/vue/vite.config.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/routes/rich.$id.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.$y.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/react/project.json
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/index.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/before-load/vue/project.json
  • benchmarks/ssr/scenarios/serialization/solid/vite.config.ts
  • benchmarks/ssr/scenarios/serialization/react/src/start.tsx
  • benchmarks/ssr/scenarios/rewrites/react/vite.config.ts
  • benchmarks/ssr/scenarios/global-middleware/react/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.ping.$id.ts
  • benchmarks/ssr/scenarios/before-load/react/src/router.tsx
  • benchmarks/ssr/scenarios/assets/react/src/styles/assets-a.css
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/assets/react/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.tsx
  • benchmarks/ssr/scenarios/assets/solid/vite.config.ts
  • benchmarks/ssr/scenarios/control-flow/react/src/routes/boom.$id.tsx
  • benchmarks/ssr/scenarios/assets/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/serialization/solid/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/project.json
  • benchmarks/ssr/scenarios/global-middleware/react/vite.config.ts
  • benchmarks/ssr/scenarios/rewrites/solid/project.json
  • benchmarks/ssr/scenarios/before-load/vue/src/routes/__root.tsx
  • benchmarks/ssr/scenarios/serialization/solid/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/vue/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/router.tsx
  • benchmarks/ssr/scenarios/serialization/react/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.$c.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.ping.$id.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/page.$id.tsx
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/vite.config.ts
  • benchmarks/ssr/scenarios/before-load/solid/src/router.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/fns.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/fns.ts
  • benchmarks/ssr/scenarios/before-load/react/tsconfig.json
  • benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/vite.config.ts
  • benchmarks/ssr/scenarios/control-flow/solid/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/assets/react/src/server.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/start.ts
  • benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.$y.tsx
  • benchmarks/ssr/scenarios/rewrites/solid/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/react/speed.bench.ts
  • benchmarks/ssr/scenarios/serialization/shared-data.ts
  • benchmarks/ssr/scenarios/serialization/solid/src/routes/plain.$id.tsx
  • benchmarks/ssr/scenarios/assets/react/src/router.tsx
  • benchmarks/ssr/scenarios/assets/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/assets/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/serialization/react/vite.config.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/router.tsx
  • benchmarks/ssr/scenarios/rewrites/vue/src/router.tsx
  • benchmarks/ssr/scenarios/before-load/react/vite.config.ts
  • benchmarks/ssr/scenarios/assets/shared.ts
  • benchmarks/ssr/scenarios/global-middleware/solid/src/routes/page.$id.tsx
  • benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.tsx
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/serialization/react/src/routes/plain.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts
  • benchmarks/ssr/scenarios/rewrites/solid/vite.config.ts
  • benchmarks/ssr/scenarios/global-middleware/vue/src/routes/index.tsx
  • benchmarks/ssr/scenarios/rewrites/react/src/routeTree.gen.ts
  • benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/src/start.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.fn-urls.ts
  • benchmarks/ssr/scenarios/serialization/react/tsconfig.json
  • benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.tsx
  • benchmarks/ssr/scenarios/global-middleware/solid/src/fns.ts
  • benchmarks/ssr/scenarios/before-load/shared-bench.ts
  • benchmarks/ssr/scenarios/global-middleware/react/src/routes/index.tsx
  • benchmarks/ssr/scenarios/rewrites/react/src/router.tsx
  • benchmarks/ssr/scenarios/assets/vue/src/server.ts
  • benchmarks/ssr/scenarios/serialization/react/src/routes/rich.$id.tsx
  • benchmarks/ssr/scenarios/control-flow/vue/src/routes/headers.$id.tsx
  • benchmarks/ssr/scenarios/global-middleware/shared.ts
  • benchmarks/ssr/scenarios/rewrites/shared.ts
  • benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.$b.tsx
  • benchmarks/ssr/scenarios/global-middleware/react/project.json
  • benchmarks/ssr/scenarios/assets/vue/speed.bench.ts
  • benchmarks/ssr/scenarios/global-middleware/bench.ts
  • benchmarks/ssr/scenarios/assets/solid/src/server.ts
  • benchmarks/ssr/package.json
  • benchmarks/ssr/scenarios/control-flow/solid/speed.bench.ts
  • benchmarks/ssr/scenarios/control-flow/shared.ts

Comment on lines +5 to +15
beforeLoad: ({ params, context }) => {
const parent = context as BeforeLoadContext

return {
chainToken: `${parent.chainToken}.${params.c}`,
ctxC: params.c,
}
},
loader: ({ context }) => ({
marker: makeBeforeLoadMarker(context as BeforeLoadContext),
}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify parent/child beforeLoad context contract and current assertions
rg -n -C3 'beforeLoad|chainToken|BeforeLoadContext|as BeforeLoadContext' \
  benchmarks/ssr/scenarios/before-load/vue/src/routes \
  benchmarks/ssr/scenarios/before-load/shared.ts

Repository: TanStack/router

Length of output: 4324


Replace as BeforeLoadContext casts with a narrowing guard for context.chainToken.

In benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.$c.tsx, beforeLoad and loader cast context to BeforeLoadContext, but BeforeLoadContext declares chainToken?: string. makeBeforeLoadMarker interpolates context.chainToken, so an unexpected/missing parent context contract would silently produce an incorrect marker. Narrow context once (e.g., type guard) before using it.

Proposed change
 import { createFileRoute } from '`@tanstack/vue-router`'
 import { makeBeforeLoadMarker, type BeforeLoadContext } from '../../../shared'
 
+function isBeforeLoadContext(value: unknown): value is BeforeLoadContext {
+  return (
+    typeof value === 'object' &&
+    value !== null &&
+    'chainToken' in value &&
+    typeof (value as { chainToken: unknown }).chainToken === 'string'
+  )
+}
+
 export const Route = createFileRoute('/$a/$b/$c')({
   beforeLoad: ({ params, context }) =&gt; {
-    const parent = context as BeforeLoadContext
+    if (!isBeforeLoadContext(context)) {
+      throw new Error('Missing chainToken in beforeLoad context')
+    }
 
     return {
-      chainToken: `${parent.chainToken}.${params.c}`,
+      chainToken: `${context.chainToken}.${params.c}`,
       ctxC: params.c,
     }
   },
-  loader: ({ context }) =&gt; ({
-    marker: makeBeforeLoadMarker(context as BeforeLoadContext),
-  }),
+  loader: ({ context }) =&gt; {
+    if (!isBeforeLoadContext(context)) {
+      throw new Error('Missing chainToken in loader context')
+    }
+
+    return {
+      marker: makeBeforeLoadMarker(context),
+    }
+  },
   component: LevelCComponent,
 })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@benchmarks/ssr/scenarios/before-load/vue/src/routes/`$a.$b.$c.tsx around
lines 5 - 15, The current casts to BeforeLoadContext in beforeLoad and loader
are unsafe because BeforeLoadContext.chainToken is optional; replace the direct
casts with a runtime narrowing guard that checks typeof context?.chainToken ===
"string" before using it (e.g., in beforeLoad when building chainToken and ctxC,
and in loader before calling makeBeforeLoadMarker). If the guard fails, handle
the missing chainToken explicitly (throw a descriptive error or return a safe
default) rather than relying on the cast so makeBeforeLoadMarker always receives
a valid chainToken.

Source: Coding guidelines

@Sheraff Sheraff merged commit 0c110a9 into main Jun 12, 2026
20 checks passed
@Sheraff Sheraff deleted the benchmark-ssr-scenarios branch June 12, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants