fix(router-core): consider __root__ in path parsing of trailing underscores #5262
main fromrefs/pull/5262/head·merged by schiller-manuel(GitHub profile, opens in a new tab) With the changes to better consider non-nested routes the root id of __root__ is being affected, which has an impact on start projects with spa mode enabled.
This updates the path parsing to take __root__ into account, and adds a set of e2e tests specific for spa mode based on the start-basic e2e test suite.
This resolves #5171
Summary by CodeRabbit#
- New Features
- Added optional SPA mode with prerendering support in the example app and a MODE-aware test helper.
- Bug Fixes
- Fixed path parsing to avoid stripping trailing underscores from the root route segment.
- Performance/UX
- Devtools now load within a Suspense boundary, improving initial render responsiveness.
- Refactor
- Route definitions updated to use explicit path-first declarations without behavioral changes.
- Tests
- E2E tests split to run in SPA and SSR modes, expanded redirect/navigation matrices and SPA-aware assertions.
- Chores
- Build and dev-server config updated to conditionally enable SPA settings and expose MODE env.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-core
View your CI Pipeline Execution ↗ for commit ebb988716fa85eed5e85f21d73baad6994c18966
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 3m 27s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 3s View ↗
☁️ Nx Cloud last updated this comment at
2025-09-27 11:16:57UTCMore templates
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-solid-start-example-bare
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-static
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
@tanstack/arktype-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5262@tanstack/directive-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5262@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5262@tanstack/history
npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5262@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5262@tanstack/react-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5262@tanstack/react-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5262@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5262@tanstack/react-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5262@tanstack/react-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5262@tanstack/react-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5262@tanstack/router-cli
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5262@tanstack/router-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5262@tanstack/router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5262@tanstack/router-devtools-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5262@tanstack/router-generator
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5262@tanstack/router-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5262@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5262@tanstack/router-utils
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5262@tanstack/router-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5262@tanstack/server-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5262@tanstack/solid-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5262@tanstack/solid-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5262@tanstack/solid-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5262@tanstack/solid-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5262@tanstack/solid-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5262@tanstack/start-client-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5262@tanstack/start-plugin-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5262@tanstack/start-server-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5262@tanstack/start-static-server-functions
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5262@tanstack/start-storage-context
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5262@tanstack/valibot-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5262@tanstack/virtual-file-routes
npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5262@tanstack/zod-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5262commit:
ebb9887Actionable comments posted: 27
🧹 Nitpick comments (33)
e2e/react-start/basic-spa/src/routes/search-params/loader-throws-redirect.tsx (1)
11-14: Preserve other search params and avoid extra history entries on default redirect.Use functional search to merge existing params and set replace: true to prevent an extra history entry.
- throw redirect({ - to: '/search-params/loader-throws-redirect', - search: { step: 'a' }, - }) + throw redirect({ + to: '/search-params/loader-throws-redirect', + search: (prev) => ({ ...prev, step: 'a' }), + replace: true, + })e2e/react-start/basic-spa/src/routes/inline-scripts.tsx (1)
4-16: Optional: add stable IDs to inline scripts for robust de‑duplicationIf head script de‑dup relies on keys, giving each inline script an id helps prevent duplicates across SSR/CSR hydration.
Apply this diff:
{ + id: 'inline-script-1', children: 'window.INLINE_SCRIPT_1 = true; console.log("Inline script 1 executed");', }, { + id: 'inline-script-2', children: 'window.INLINE_SCRIPT_2 = "test"; console.log("Inline script 2 executed");', type: 'text/javascript', },e2e/react-start/basic-spa/src/routes/search-params/default.tsx (1)
8-17: Optional: DRY the repeated context checkThe beforeLoad and loader checks are identical. Extract into a small helper for clarity.
Apply this diff in-place:
- beforeLoad: ({ context }) => { - if (context.hello !== 'world') { - throw new Error('Context hello is not "world"') - } - }, - loader: ({ context }) => { - if (context.hello !== 'world') { - throw new Error('Context hello is not "world"') - } - }, + beforeLoad: ({ context }) => assertWorld(context), + loader: ({ context }) => assertWorld(context),Add this helper near the top of the file:
const assertWorld = (context: { hello?: unknown }) => { if (context.hello !== 'world') { throw new Error('Context hello is not "world"') } }e2e/react-start/basic-spa/src/utils/users.tsx (1)
1-5: Nit: this utility doesn’t use JSX; consider .ts instead of .tsx.Slightly improves build ergonomics and signals intent.
packages/router-core/src/path.ts (2)
279-281: Good fix: preserve "root" while stripping trailing underscores elsewhere.This aligns with the intended behavior (strip on route segments, preserve special/base segments). Consider avoiding the magic string and using a shared constant, and prefer
endsWithfor clarity.Apply this diff:
- !basePathValues && part !== '__root__' && part.slice(-1) === '_' + !basePathValues && part !== ROOT_ROUTE_ID && part.endsWith('_') ? part.slice(0, -1) : partAdd near the top of this module (or import from a shared constants file if one exists):
const ROOT_ROUTE_ID = '__root__'This reduces typos and centralizes the identifier. Based on learnings.
214-225: Cache key likely conflates base vs route parsing (potentially incorrect results).parsePathnamecaches bypathnameonly, but parsing differs whenbasePathValuesis true vs false. If the same string is parsed both ways sharing the same cache, results can be wrong. Safer to include the mode in the cache key.Apply this diff:
export const parsePathname = ( pathname?: string, cache?: ParsePathnameCache, basePathValues?: boolean, ): ReadonlyArray<Segment> => { if (!pathname) return [] - const cached = cache?.get(pathname) + const cacheKey = `${basePathValues ? 'b' : 'r'}|${pathname}` + const cached = cache?.get(cacheKey) if (cached) return cached const parsed = baseParsePathname(pathname, basePathValues) - cache?.set(pathname, parsed) + cache?.set(cacheKey, parsed) return parsed }Please verify if a shared
parseCacheinstance is passed to bothparseBasePathSegmentsandparseRoutePathSegmentsin any hot paths. If yes, this change prevents subtle mismatches. Based on learnings.e2e/react-start/basic-spa/src/styles/app.css (1)
1-22: LGTM: Tailwind layers and dark mode base styles.The
.using-mouse * { outline: none }pattern is acceptable for e2e. If this ever ships to prod, consider preferring:focus-visibleutilities to preserve keyboard focus indicators.e2e/react-start/basic-spa/src/utils/seo.ts (1)
12-33: Avoid emitting meta tags with undefined content.Guard optional fields so consumers don’t get
content="undefined".Apply this diff:
- const tags = [ - { title }, - { name: 'description', content: description }, - { name: 'keywords', content: keywords }, - { name: 'twitter:title', content: title }, - { name: 'twitter:description', content: description }, - { name: 'twitter:creator', content: '@tannerlinsley' }, - { name: 'twitter:site', content: '@tannerlinsley' }, - { name: 'og:type', content: 'website' }, - { name: 'og:title', content: title }, - { name: 'og:description', content: description }, - ...(image - ? [ - { name: 'twitter:image', content: image }, - { name: 'twitter:card', content: 'summary_large_image' }, - { name: 'og:image', content: image }, - ] - : []), - ] + const tags = [ + { title }, + ...(description ? [{ name: 'description', content: description }] : []), + ...(keywords ? [{ name: 'keywords', content: keywords }] : []), + { name: 'twitter:title', content: title }, + ...(description ? [{ name: 'twitter:description', content: description }] : []), + { name: 'twitter:creator', content: '@tannerlinsley' }, + { name: 'twitter:site', content: '@tannerlinsley' }, + { name: 'og:type', content: 'website' }, + { name: 'og:title', content: title }, + ...(description ? [{ name: 'og:description', content: description }] : []), + ...(image + ? [ + { name: 'twitter:image', content: image }, + { name: 'twitter:card', content: 'summary_large_image' }, + { name: 'og:image', content: image }, + ] + : []), + ]e2e/react-start/basic-spa/src/components/RedirectOnClick.tsx (1)
17-24: Prevent accidental form submit and unhandled promise rejections- Add type="button" to avoid submitting if used inside a form.
- Handle the promise so redirect rejections don’t surface as unhandled errors.
Apply this diff:
return ( <button + type="button" data-testid="redirect-on-click" - onClick={() => - execute({ data: { target, reloadDocument, externalHost } }) - } + onClick={async () => { + try { + await execute({ data: { target, reloadDocument, externalHost } }) + } catch { + // Redirect is handled by the framework + } + }} > click me </button> )e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx (1)
1-10: Validate and coerce search params to expected typesEnsure reloadDocument is a boolean (not a "true"/"false" string) and externalHost is a string. Add validateSearch with zod for predictable behavior in SPA mode.
Apply this diff:
-import { createFileRoute } from '@tanstack/react-router' +import { createFileRoute } from '@tanstack/react-router' +import { z } from 'zod' import { throwRedirect } from '~/components/throwRedirect' export const Route = createFileRoute('/redirect/$target/serverFn/via-beforeLoad')({ + validateSearch: z.object({ + reloadDocument: z.boolean().optional(), + externalHost: z.string().optional(), + }), beforeLoad: ({ params: { target }, search: { reloadDocument, externalHost }, }) => throwRedirect({ data: { target, reloadDocument, externalHost } }), component: () => <div>{Route.fullPath}</div>, })e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-loader.tsx (1)
9-11: Optional: await the serverFn for clarityThe router will await the loader’s returned promise, but making it explicit reads clearer.
- loader: ({ params: { target }, deps: { reloadDocument, externalHost } }) => - throwRedirect({ data: { target, reloadDocument, externalHost } }), + loader: async ({ + params: { target }, + deps: { reloadDocument, externalHost }, + }) => { + await throwRedirect({ data: { target, reloadDocument, externalHost } }) + },e2e/react-start/basic-spa/src/components/DefaultCatchBoundary.tsx (1)
17-17: Gate console.error in productionConsole noise in CI/production can be distracting; consider gating behind an env check.
- console.error(error) + if (import.meta.env.DEV) console.error(error)e2e/react-start/basic-spa/src/routes/scripts.tsx (1)
6-16: Avoid undefined entries and prefer absolute paths for public assetsPrevent undefined in scripts array and use absolute paths for stability with varying base URLs.
head: () => ({ scripts: [ - { - src: 'script.js', - }, - isProd - ? undefined - : { - src: 'script2.js', - }, + { src: '/script.js' }, + ...(isProd ? [] : [{ src: '/script2.js' }]), ], }),e2e/react-start/basic-spa/src/components/throwRedirect.ts (1)
12-23: Optional: validate external URL before redirectGuard against malformed externalHost by validating it; fall back to example.com if invalid. Keeps behavior robust for test inputs.
- .handler((ctx) => { + .handler((ctx) => { if (ctx.data.target === 'internal') { throw redirect({ to: '/posts', reloadDocument: ctx.data.reloadDocument, }) } - const href = ctx.data.externalHost ?? 'http://example.com' + const href = (() => { + const candidate = ctx.data.externalHost ?? 'http://example.com' + try { + return new URL(candidate).toString() + } catch { + return 'http://example.com' + } + })() throw redirect({ href, }) })e2e/react-start/basic-spa/src/routes/users.tsx (2)
24-27: Keepidtype consistent withUserAppending a string
idwidens the array element type and weakens type safety. Use a numeric sentinel to stay compatible withUser.- {[ - ...users, - { id: 'i-do-not-exist', name: 'Non-existent User', email: '' }, - ].map((user) => { + {[ + ...users, + { id: -1, name: 'Non-existent User', email: '' }, + ].map((user) => {
7-14: Minor: simplify loader with try/catchReadability nit: using try/catch avoids promise chaining.
- loader: async () => { - return await axios - .get<Array<User>>('/api/users') - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch users') - }) - }, + loader: async () => { + try { + const { data } = await axios.get<Array<User>>('/api/users') + return data + } catch { + throw new Error('Failed to fetch users') + } + },e2e/react-start/basic-spa/src/routes/posts.tsx (1)
13-13: Remove redundantasyncNo
awaitused; keep it simple.- loader: async () => fetchPosts(), + loader: () => fetchPosts(),e2e/react-start/basic-spa/src/routes/redirect/$target/via-loader.tsx (1)
12-14: Guard against undefinedexternalHostRedirecting with
href: undefinedcan throw; validate before redirect.- case 'external': - throw redirect({ href: externalHost }) + case 'external': + if (!externalHost) { + throw new Error('externalHost is required for external redirects') + } + throw redirect({ href: externalHost })e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-useServerFn.tsx (1)
6-8: Provide a safe default forreloadDocumentPrevents passing
undefinedinto the server fn flow.- const { reloadDocument, externalHost } = Route.useSearch() + const { reloadDocument = false, externalHost } = Route.useSearch()e2e/react-start/basic-spa/src/routes/api/users.$id.ts (2)
18-18: Minor: prefer template strings for URL assembly.Slightly clearer and avoids implicit string coercion.
- const res = await axios.get<User>(`${queryURL}/users/` + params.id) + const res = await axios.get<User>(`${queryURL}/users/${params.id}`)
11-15: Optional: deduplicate env base-URL selection.This logic appears in multiple files; consider extracting a getExternalApiBaseUrl() helper to keep it consistent.
e2e/react-start/basic-spa/tests/not-found.spec.ts (1)
41-43: Use Playwright's waitForTimeout instead of manual Promise.Cleaner and integrates with Playwright timing controls.
- await new Promise((r) => setTimeout(r, 250)) + await page.waitForTimeout(250)e2e/react-start/basic-spa/tests/navigation.spec.ts (1)
17-17: Make the post link selector less brittle.Use a case-insensitive regex to reduce reliance on an exact truncated title.
- await page.getByRole('link', { name: 'sunt aut facere repe' }).click() + await page.getByRole('link', { name: /sunt aut facere/i }).click()e2e/react-start/basic-spa/src/utils/posts.tsx (1)
11-15: Optional: centralize external API base URL logic.Extract to a shared util to avoid drift with other modules (e.g., users route).
e2e/react-start/basic-spa/playwright.config.ts (2)
6-10: Avoid JSON import attributes to keep config compatible across Node/TS setupsimport packageJson ... with { type: 'json' }requires ESM + Node support for import attributes. This can break under Node 18 or TS configs without resolveJsonModule/import attributes. Prefer reading package.json via fs to avoid env fragility. Also confirm CI uses a Node/TS combo that supports top‑level await in TS config files.Proposed change:
-import packageJson from './package.json' with { type: 'json' } +import fs from 'node:fs' + +const pkgName: string = JSON.parse( + fs.readFileSync(new URL('./package.json', import.meta.url), 'utf-8'), +).name + -const PORT = await getTestServerPort(packageJson.name) -const EXTERNAL_PORT = await getDummyServerPort(packageJson.name) +const PORT = await getTestServerPort(pkgName) +const EXTERNAL_PORT = await getDummyServerPort(pkgName)Verification checklist:
- CI Node version >= 20 if you want to keep import attributes and top-level await in TS configs.
- tsconfig for this e2e fixture: "moduleResolution" supports ESM, and "resolveJsonModule": true if sticking with JSON imports. As per coding guidelines (TypeScript strict mode), keep type-safety intact.
28-33: Set env via webServer.env and add a timeout for resiliencyInlining env vars in the command is brittle across shells. Prefer webServer.env and add a timeout to avoid indefinite waits if the dev server fails.
Apply:
webServer: { - command: `VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm run dev:e2e --port=${PORT}`, + command: `pnpm run dev:e2e --port=${PORT}`, url: baseURL, reuseExistingServer: !process.env.CI, stdout: 'pipe', + timeout: 120_000, + env: { + VITE_EXTERNAL_PORT: String(EXTERNAL_PORT), + VITE_SERVER_PORT: String(PORT), + PORT: String(PORT), + }, },e2e/react-start/basic-spa/tests/script-duplication.spec.ts (6)
9-16: Make script selector robust and use locator assertions to reduce flakeExact match
script[src="script.js"]is brittle (absolute vs relative URL). Prefer ends-with andtoHaveCounton a locator.Apply:
- const scriptCount = await page.evaluate(() => { - return document.querySelectorAll('script[src="script.js"]').length - }) - - expect(scriptCount).toBe(1) + await expect(page.locator('script[src$="/script.js"]')).toHaveCount(1)
26-41: Repeat the robust selector pattern for client-side nav checksSame concern as above; use locator + toHaveCount for both checks.
Apply:
- const firstNavCount = await page.evaluate(() => { - return document.querySelectorAll('script[src="script.js"]').length - }) - expect(firstNavCount).toBe(1) + await expect(page.locator('script[src$="/script.js"]')).toHaveCount(1) @@ - const secondNavCount = await page.evaluate(() => { - return document.querySelectorAll('script[src="script.js"]').length - }) - expect(secondNavCount).toBe(1) + await expect(page.locator('script[src$="/script.js"]')).toHaveCount(1)
61-66: Use locator count at the end of multi-nav test to avoid timing pitfallsSwitch to locator with ends-with selector for consistency and less flakiness.
Apply:
- const finalCount = await page.evaluate(() => { - return document.querySelectorAll('script[src="script.js"]').length - }) - expect(finalCount).toBe(1) + await expect(page.locator('script[src$="/script.js"]')).toHaveCount(1)
76-96: Inline script detection by raw text is brittle; use locator hasText filterExact textContent matching can break on formatting/minification. Use locator text filters.
Apply:
- const script1Count = await page.evaluate(() => { - const scripts = Array.from(document.querySelectorAll('script:not([src])')) - return scripts.filter( - (script) => - script.textContent && - script.textContent.includes('window.INLINE_SCRIPT_1 = true'), - ).length - }) + const script1Locator = page.locator('script:not([src])', { + hasText: 'window.INLINE_SCRIPT_1 = true', + }) - const script2Count = await page.evaluate(() => { - const scripts = Array.from(document.querySelectorAll('script:not([src])')) - return scripts.filter( - (script) => - script.textContent && - script.textContent.includes('window.INLINE_SCRIPT_2 = "test"'), - ).length - }) + const script2Locator = page.locator('script:not([src])', { + hasText: 'window.INLINE_SCRIPT_2 = "test"', + }) - expect(script1Count).toBe(1) - expect(script2Count).toBe(1) + await expect(script1Locator).toHaveCount(1) + await expect(script2Locator).toHaveCount(1)
111-120: Same robustness for inline scripts during client-side navigationUse locator filters instead of manual evaluation.
Apply:
- const firstNavScript1Count = await page.evaluate(() => { - const scripts = Array.from(document.querySelectorAll('script:not([src])')) - return scripts.filter( - (script) => - script.textContent && - script.textContent.includes('window.INLINE_SCRIPT_1 = true'), - ).length - }) - expect(firstNavScript1Count).toBe(1) + await expect( + page.locator('script:not([src])', { + hasText: 'window.INLINE_SCRIPT_1 = true', + }), + ).toHaveCount(1)
139-142: Stabilize script readiness with waitForFunction when asserting globalsTo reduce flakiness, wait until globals are set before asserting.
Apply:
- // Verify the scripts are still working - expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true) - expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test') + await page.waitForFunction(() => (window as any).INLINE_SCRIPT_1 === true) + await page.waitForFunction(() => (window as any).INLINE_SCRIPT_2 === 'test')e2e/react-start/basic-spa/tests/redirect.spec.ts (1)
1-1: Optional: Prefer URLSearchParams over legacynode:querystringnode:querystringis legacy;URLSearchParamsis modern and built-in.Example:
const q = new URLSearchParams({ externalHost: `http://localhost:${EXTERNAL_HOST_PORT}/` }).toString()📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 56f6f8df651b3400bc527a58c78f74c3b08a9904 and 92280f42553faf2dbb2b84eaa79810a854909425.
⛔ Files ignored due to path filters (8)
e2e/react-start/basic-spa/public/android-chrome-192x192.pngis excluded by!**/*.pnge2e/react-start/basic-spa/public/android-chrome-512x512.pngis excluded by!**/*.pnge2e/react-start/basic-spa/public/apple-touch-icon.pngis excluded by!**/*.pnge2e/react-start/basic-spa/public/favicon-16x16.pngis excluded by!**/*.pnge2e/react-start/basic-spa/public/favicon-32x32.pngis excluded by!**/*.pnge2e/react-start/basic-spa/public/favicon.icois excluded by!**/*.icoe2e/react-start/basic-spa/public/favicon.pngis excluded by!**/*.pngpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (74)
e2e/react-start/basic-spa/.gitignore(1 hunks)e2e/react-start/basic-spa/.prettierignore(1 hunks)e2e/react-start/basic-spa/package.json(1 hunks)e2e/react-start/basic-spa/playwright.config.ts(1 hunks)e2e/react-start/basic-spa/postcss.config.mjs(1 hunks)e2e/react-start/basic-spa/public/script.js(1 hunks)e2e/react-start/basic-spa/public/script2.js(1 hunks)e2e/react-start/basic-spa/public/site.webmanifest(1 hunks)e2e/react-start/basic-spa/src/client.tsx(1 hunks)e2e/react-start/basic-spa/src/components/CustomMessage.tsx(1 hunks)e2e/react-start/basic-spa/src/components/DefaultCatchBoundary.tsx(1 hunks)e2e/react-start/basic-spa/src/components/NotFound.tsx(1 hunks)e2e/react-start/basic-spa/src/components/RedirectOnClick.tsx(1 hunks)e2e/react-start/basic-spa/src/components/throwRedirect.ts(1 hunks)e2e/react-start/basic-spa/src/routeTree.gen.ts(1 hunks)e2e/react-start/basic-spa/src/router.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/__root.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/_layout.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/_layout/_layout-2.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-a.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-b.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/api.users.ts(1 hunks)e2e/react-start/basic-spa/src/routes/api/users.$id.ts(1 hunks)e2e/react-start/basic-spa/src/routes/deferred.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here/index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/inline-scripts.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/links.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/not-found/index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/not-found/route.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/not-found/via-loader.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/posts.$postId.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/posts.index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/posts.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target/index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-loader.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-useServerFn.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target/via-beforeLoad.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target/via-loader.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/scripts.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/search-params/default.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/search-params/index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/search-params/loader-throws-redirect.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/search-params/route.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/stream.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/users.$userId.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/users.index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/users.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/대한민국.tsx(1 hunks)e2e/react-start/basic-spa/src/server.ts(1 hunks)e2e/react-start/basic-spa/src/styles/app.css(1 hunks)e2e/react-start/basic-spa/src/utils/posts.tsx(1 hunks)e2e/react-start/basic-spa/src/utils/seo.ts(1 hunks)e2e/react-start/basic-spa/src/utils/users.tsx(1 hunks)e2e/react-start/basic-spa/tailwind.config.mjs(1 hunks)e2e/react-start/basic-spa/tests/navigation.spec.ts(1 hunks)e2e/react-start/basic-spa/tests/not-found.spec.ts(1 hunks)e2e/react-start/basic-spa/tests/params.spec.ts(1 hunks)e2e/react-start/basic-spa/tests/redirect.spec.ts(1 hunks)e2e/react-start/basic-spa/tests/script-duplication.spec.ts(1 hunks)e2e/react-start/basic-spa/tests/search-params.spec.ts(1 hunks)e2e/react-start/basic-spa/tests/setup/global.setup.ts(1 hunks)e2e/react-start/basic-spa/tests/setup/global.teardown.ts(1 hunks)e2e/react-start/basic-spa/tests/streaming.spec.ts(1 hunks)e2e/react-start/basic-spa/tsconfig.json(1 hunks)e2e/react-start/basic-spa/vite.config.ts(1 hunks)packages/router-core/src/path.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/react-start/basic-spa/tsconfig.jsone2e/react-start/basic-spa/public/script2.jse2e/react-start/basic-spa/src/utils/users.tsxe2e/react-start/basic-spa/public/site.webmanifeste2e/react-start/basic-spa/tailwind.config.mjse2e/react-start/basic-spa/src/routes/redirect/index.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/via-beforeLoad.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-beforeLoad.tsxe2e/react-start/basic-spa/src/routes/redirect/$target.tsxe2e/react-start/basic-spa/src/routes/api.users.tse2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here.tsxe2e/react-start/basic-spa/playwright.config.tse2e/react-start/basic-spa/src/routes/posts.index.tsxe2e/react-start/basic-spa/src/components/RedirectOnClick.tsxe2e/react-start/basic-spa/src/routes/_layout/_layout-2.tsxe2e/react-start/basic-spa/vite.config.tse2e/react-start/basic-spa/src/routes/users.$userId.tsxe2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-a.tsxe2e/react-start/basic-spa/tests/params.spec.tse2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-b.tsxe2e/react-start/basic-spa/src/routes/links.tsxe2e/react-start/basic-spa/src/routes/not-found/via-loader.tsxe2e/react-start/basic-spa/src/utils/posts.tsxe2e/react-start/basic-spa/public/script.jse2e/react-start/basic-spa/src/routes/search-params/route.tsxe2e/react-start/basic-spa/src/routes/posts.$postId.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/index.tsxe2e/react-start/basic-spa/src/router.tsxe2e/react-start/basic-spa/src/routeTree.gen.tse2e/react-start/basic-spa/src/routes/stream.tsxe2e/react-start/basic-spa/src/routes/index.tsxe2e/react-start/basic-spa/src/styles/app.csse2e/react-start/basic-spa/src/components/NotFound.tsxe2e/react-start/basic-spa/src/utils/seo.tse2e/react-start/basic-spa/tests/redirect.spec.tse2e/react-start/basic-spa/tests/search-params.spec.tse2e/react-start/basic-spa/src/routes/users.index.tsxe2e/react-start/basic-spa/src/server.tse2e/react-start/basic-spa/src/routes/not-found/route.tsxe2e/react-start/basic-spa/src/routes/__root.tsxe2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsxe2e/react-start/basic-spa/tests/setup/global.teardown.tse2e/react-start/basic-spa/src/routes/_layout.tsxe2e/react-start/basic-spa/src/routes/search-params/loader-throws-redirect.tsxe2e/react-start/basic-spa/tests/script-duplication.spec.tse2e/react-start/basic-spa/src/routes/redirect/$target/index.tsxe2e/react-start/basic-spa/tests/not-found.spec.tse2e/react-start/basic-spa/src/routes/not-found/index.tsxe2e/react-start/basic-spa/src/components/CustomMessage.tsxe2e/react-start/basic-spa/src/components/DefaultCatchBoundary.tsxe2e/react-start/basic-spa/src/routes/scripts.tsxe2e/react-start/basic-spa/src/routes/search-params/index.tsxe2e/react-start/basic-spa/tests/setup/global.setup.tse2e/react-start/basic-spa/postcss.config.mjse2e/react-start/basic-spa/src/components/throwRedirect.tse2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here/index.tsxe2e/react-start/basic-spa/src/routes/posts.tsxe2e/react-start/basic-spa/tests/navigation.spec.tse2e/react-start/basic-spa/src/routes/users.tsxe2e/react-start/basic-spa/src/routes/deferred.tsxe2e/react-start/basic-spa/package.jsone2e/react-start/basic-spa/tests/streaming.spec.tse2e/react-start/basic-spa/src/routes/redirect/$target/via-loader.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-loader.tsxe2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsxe2e/react-start/basic-spa/src/routes/대한민국.tsxe2e/react-start/basic-spa/src/routes/search-params/default.tsxe2e/react-start/basic-spa/src/client.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-useServerFn.tsxe2e/react-start/basic-spa/src/routes/inline-scripts.tsxe2e/react-start/basic-spa/src/routes/api/users.$id.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/react-start/basic-spa/src/utils/users.tsxe2e/react-start/basic-spa/src/routes/redirect/index.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/via-beforeLoad.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-beforeLoad.tsxe2e/react-start/basic-spa/src/routes/redirect/$target.tsxe2e/react-start/basic-spa/src/routes/api.users.tse2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here.tsxe2e/react-start/basic-spa/playwright.config.tse2e/react-start/basic-spa/src/routes/posts.index.tsxpackages/router-core/src/path.tse2e/react-start/basic-spa/src/components/RedirectOnClick.tsxe2e/react-start/basic-spa/src/routes/_layout/_layout-2.tsxe2e/react-start/basic-spa/vite.config.tse2e/react-start/basic-spa/src/routes/users.$userId.tsxe2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-a.tsxe2e/react-start/basic-spa/tests/params.spec.tse2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-b.tsxe2e/react-start/basic-spa/src/routes/links.tsxe2e/react-start/basic-spa/src/routes/not-found/via-loader.tsxe2e/react-start/basic-spa/src/utils/posts.tsxe2e/react-start/basic-spa/src/routes/search-params/route.tsxe2e/react-start/basic-spa/src/routes/posts.$postId.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/index.tsxe2e/react-start/basic-spa/src/router.tsxe2e/react-start/basic-spa/src/routeTree.gen.tse2e/react-start/basic-spa/src/routes/stream.tsxe2e/react-start/basic-spa/src/routes/index.tsxe2e/react-start/basic-spa/src/components/NotFound.tsxe2e/react-start/basic-spa/src/utils/seo.tse2e/react-start/basic-spa/tests/redirect.spec.tse2e/react-start/basic-spa/tests/search-params.spec.tse2e/react-start/basic-spa/src/routes/users.index.tsxe2e/react-start/basic-spa/src/server.tse2e/react-start/basic-spa/src/routes/not-found/route.tsxe2e/react-start/basic-spa/src/routes/__root.tsxe2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsxe2e/react-start/basic-spa/tests/setup/global.teardown.tse2e/react-start/basic-spa/src/routes/_layout.tsxe2e/react-start/basic-spa/src/routes/search-params/loader-throws-redirect.tsxe2e/react-start/basic-spa/tests/script-duplication.spec.tse2e/react-start/basic-spa/src/routes/redirect/$target/index.tsxe2e/react-start/basic-spa/tests/not-found.spec.tse2e/react-start/basic-spa/src/routes/not-found/index.tsxe2e/react-start/basic-spa/src/components/CustomMessage.tsxe2e/react-start/basic-spa/src/components/DefaultCatchBoundary.tsxe2e/react-start/basic-spa/src/routes/scripts.tsxe2e/react-start/basic-spa/src/routes/search-params/index.tsxe2e/react-start/basic-spa/tests/setup/global.setup.tse2e/react-start/basic-spa/src/components/throwRedirect.tse2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here/index.tsxe2e/react-start/basic-spa/src/routes/posts.tsxe2e/react-start/basic-spa/tests/navigation.spec.tse2e/react-start/basic-spa/src/routes/users.tsxe2e/react-start/basic-spa/src/routes/deferred.tsxe2e/react-start/basic-spa/tests/streaming.spec.tse2e/react-start/basic-spa/src/routes/redirect/$target/via-loader.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-loader.tsxe2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsxe2e/react-start/basic-spa/src/routes/대한민국.tsxe2e/react-start/basic-spa/src/routes/search-params/default.tsxe2e/react-start/basic-spa/src/client.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-useServerFn.tsxe2e/react-start/basic-spa/src/routes/inline-scripts.tsxe2e/react-start/basic-spa/src/routes/api/users.$id.ts
**/src/routes/**
📄 CodeRabbit inference engine (AGENTS.md)
Place file-based routes under src/routes/ directories
Files:
e2e/react-start/basic-spa/src/routes/redirect/index.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/via-beforeLoad.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-beforeLoad.tsxe2e/react-start/basic-spa/src/routes/redirect/$target.tsxe2e/react-start/basic-spa/src/routes/api.users.tse2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here.tsxe2e/react-start/basic-spa/src/routes/posts.index.tsxe2e/react-start/basic-spa/src/routes/_layout/_layout-2.tsxe2e/react-start/basic-spa/src/routes/users.$userId.tsxe2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-a.tsxe2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-b.tsxe2e/react-start/basic-spa/src/routes/links.tsxe2e/react-start/basic-spa/src/routes/not-found/via-loader.tsxe2e/react-start/basic-spa/src/routes/search-params/route.tsxe2e/react-start/basic-spa/src/routes/posts.$postId.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/index.tsxe2e/react-start/basic-spa/src/routes/stream.tsxe2e/react-start/basic-spa/src/routes/index.tsxe2e/react-start/basic-spa/src/routes/users.index.tsxe2e/react-start/basic-spa/src/routes/not-found/route.tsxe2e/react-start/basic-spa/src/routes/__root.tsxe2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsxe2e/react-start/basic-spa/src/routes/_layout.tsxe2e/react-start/basic-spa/src/routes/search-params/loader-throws-redirect.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/index.tsxe2e/react-start/basic-spa/src/routes/not-found/index.tsxe2e/react-start/basic-spa/src/routes/scripts.tsxe2e/react-start/basic-spa/src/routes/search-params/index.tsxe2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here/index.tsxe2e/react-start/basic-spa/src/routes/posts.tsxe2e/react-start/basic-spa/src/routes/users.tsxe2e/react-start/basic-spa/src/routes/deferred.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/via-loader.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-loader.tsxe2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsxe2e/react-start/basic-spa/src/routes/대한민국.tsxe2e/react-start/basic-spa/src/routes/search-params/default.tsxe2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-useServerFn.tsxe2e/react-start/basic-spa/src/routes/inline-scripts.tsxe2e/react-start/basic-spa/src/routes/api/users.$id.ts
packages/router-core/**
📄 CodeRabbit inference engine (AGENTS.md)
Keep framework-agnostic core router logic in packages/router-core/
Files:
packages/router-core/src/path.ts
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Use workspace:* protocol for internal dependencies in package.json files
Files:
e2e/react-start/basic-spa/package.json
🧠 Learnings (6)
📓 Common learnings
Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx:3-5 Timestamp: 2025-09-22T00:56:49.237Z Learning: In TanStack Router, underscores are intentionally stripped from route segments (e.g., `$baz_` becomes `baz` in generated types) but should be preserved in base path segments. This is the correct behavior as of the fix in PR #5182.Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts:167-172 Timestamp: 2025-09-22T00:56:53.426Z Learning: In TanStack Router, underscores are intentionally stripped from route segments during path parsing, but preserved in base path segments. This is the expected behavior implemented in PR #5182.📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to **/*.{ts,tsx} : Use TypeScript in strict mode with extensive type safety across the codebaseApplied to files:
e2e/react-start/basic-spa/tsconfig.json
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{router-cli,router-generator,router-plugin,virtual-file-routes}/** : Keep CLI, generators, bundler plugins, and virtual file routing utilities in their dedicated tooling package directoriesApplied to files:
e2e/react-start/basic-spa/.prettierignore
📚 Learning: 2025-09-22T00:56:49.237Z
Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx:3-5 Timestamp: 2025-09-22T00:56:49.237Z Learning: In TanStack Router, underscores are intentionally stripped from route segments (e.g., `$baz_` becomes `baz` in generated types) but should be preserved in base path segments. This is the correct behavior as of the fix in PR #5182.Applied to files:
packages/router-core/src/path.ts
📚 Learning: 2025-09-22T00:56:53.426Z
Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts:167-172 Timestamp: 2025-09-22T00:56:53.426Z Learning: In TanStack Router, underscores are intentionally stripped from route segments during path parsing, but preserved in base path segments. This is the expected behavior implemented in PR #5182.Applied to files:
packages/router-core/src/path.ts
📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/Applied to files:
e2e/react-start/basic-spa/src/routes/__root.tsxe2e/react-start/basic-spa/src/routes/scripts.tsxe2e/react-start/basic-spa/src/routes/inline-scripts.tsx
🧬 Code graph analysis (47)
e2e/react-start/basic-spa/src/routes/redirect/index.tsx (2)
e2e/react-start/basic-spa/src/routes/links.tsx (1)
Route(3-47)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (1)
Route(3-31)
e2e/react-start/basic-spa/src/routes/redirect/$target/via-beforeLoad.tsx (2)
e2e/react-start/basic-spa/src/routes/links.tsx (1)
Route(3-47)
e2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsx (1)
Route(3-15)
e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx (2)
e2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsx (1)
Route(3-15)
e2e/react-start/basic-spa/src/components/throwRedirect.ts (1)
throwRedirect(4-23)
e2e/react-start/basic-spa/src/routes/redirect/$target.tsx (1)
e2e/react-start/basic-spa/src/routes/not-found/route.tsx (1)
Route(4-8)
e2e/react-start/basic-spa/src/routes/api.users.ts (2)
e2e/react-start/basic-spa/src/routes/api/users.$id.ts (1)
Route(12-32)
e2e/react-start/basic-spa/src/utils/users.tsx (1)
User(1-5)
e2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here.tsx (1)
e2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here/index.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/posts.index.tsx (1)
e2e/react-start/basic-spa/src/routes/links.tsx (1)
Route(3-47)
e2e/react-start/basic-spa/src/components/RedirectOnClick.tsx (1)
e2e/react-start/basic-spa/src/components/throwRedirect.ts (1)
throwRedirect(4-23)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2.tsx (3)
e2e/react-start/basic-spa/src/routes/_layout.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-a.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-b.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/users.$userId.tsx (3)
e2e/react-start/basic-spa/src/routes/api/users.$id.ts (1)
Route(12-32)
e2e/react-start/basic-spa/src/utils/users.tsx (1)
User(1-5)
e2e/react-start/basic-spa/src/components/NotFound.tsx (1)
NotFound(3-25)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-a.tsx (4)
e2e/react-start/basic-spa/src/routes/__root.tsx (1)
Route(16-75)
e2e/react-start/basic-spa/src/routes/_layout.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-b.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-b.tsx (3)
e2e/react-start/basic-spa/src/routes/_layout.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-a.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/links.tsx (2)
e2e/react-start/basic-spa/src/routes/index.tsx (1)
Route(4-6)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (1)
Route(3-31)
e2e/react-start/basic-spa/src/routes/not-found/via-loader.tsx (3)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (1)
Route(3-31)
e2e/react-start/basic-spa/src/routes/not-found/route.tsx (1)
Route(4-8)
e2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsx (1)
Route(3-15)
e2e/react-start/basic-spa/src/utils/posts.tsx (1)
e2e/react-router/js-only-file-based/src/posts.js (1)
queryURL(5-5)
e2e/react-start/basic-spa/src/routes/search-params/route.tsx (2)
e2e/react-start/basic-spa/src/routes/deferred.tsx (1)
Route(18-29)
e2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsx (1)
Route(3-15)
e2e/react-start/basic-spa/src/routes/posts.$postId.tsx (2)
e2e/react-start/basic-spa/src/utils/posts.tsx (1)
fetchPost(17-33)
e2e/react-start/basic-spa/src/components/NotFound.tsx (1)
NotFound(3-25)
e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/index.tsx (3)
e2e/react-start/basic-spa/src/routes/links.tsx (1)
Route(3-47)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (1)
Route(3-31)
e2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsx (1)
Route(3-15)
e2e/react-start/basic-spa/src/router.tsx (2)
e2e/react-start/basic-spa/src/components/DefaultCatchBoundary.tsx (1)
DefaultCatchBoundary(10-53)
e2e/react-start/basic-spa/src/components/NotFound.tsx (1)
NotFound(3-25)
e2e/react-start/basic-spa/src/routeTree.gen.ts (1)
e2e/react-start/basic-spa/src/router.tsx (1)
getRouter(6-16)
e2e/react-start/basic-spa/src/routes/stream.tsx (2)
e2e/react-start/basic-spa/src/routes/deferred.tsx (1)
Route(18-29)
e2e/react-start/basic-spa/src/routes/index.tsx (1)
Route(4-6)
e2e/react-start/basic-spa/src/routes/index.tsx (1)
e2e/react-start/basic-spa/src/components/CustomMessage.tsx (1)
CustomMessage(3-10)
e2e/react-start/basic-spa/src/components/NotFound.tsx (1)
e2e/react-start/server-routes/src/components/NotFound.tsx (1)
NotFound(3-25)
e2e/react-start/basic-spa/tests/redirect.spec.ts (1)
e2e/react-start/basic/tests/redirect.spec.ts (2)
internalNavigationTestMatrix(17-208)test(132-168)
e2e/react-start/basic-spa/src/routes/not-found/route.tsx (1)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (1)
Route(3-31)
e2e/react-start/basic-spa/src/routes/__root.tsx (3)
e2e/react-start/basic-spa/src/utils/seo.ts (1)
seo(1-33)
e2e/react-start/basic-spa/src/components/DefaultCatchBoundary.tsx (1)
DefaultCatchBoundary(10-53)
e2e/react-start/basic-spa/src/components/NotFound.tsx (1)
NotFound(3-25)
e2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsx (2)
e2e/react-start/basic-spa/src/utils/posts.tsx (1)
fetchPost(17-33)
e2e/react-start/basic-spa/src/routes/posts.$postId.tsx (1)
PostErrorComponent(16-18)
e2e/react-start/basic-spa/tests/setup/global.teardown.ts (9)
e2e/solid-router/basic-file-based/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/react-router/basic-esbuild-file-based/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/solid-router/basic-virtual-file-based/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/solid-router/basic-solid-query-file-based/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/solid-router/basic-virtual-named-export-config-file-based/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/react-router/generator-cli-only/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/solid-router/basic-solid-query/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/solid-router/basic/tests/setup/global.teardown.ts (1)
teardown(4-6)
e2e/react-start/basic-spa/src/routes/_layout.tsx (3)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-a.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/_layout/_layout-2/layout-b.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/search-params/loader-throws-redirect.tsx (2)
e2e/react-start/basic-spa/src/routes/not-found/route.tsx (1)
Route(4-8)
e2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsx (1)
Route(3-15)
e2e/react-start/basic-spa/src/routes/redirect/$target/index.tsx (3)
e2e/react-start/basic-spa/src/routes/links.tsx (1)
Route(3-47)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (1)
Route(3-31)
e2e/react-start/basic-spa/src/routes/not-found/route.tsx (1)
Route(4-8)
e2e/react-start/basic-spa/tests/not-found.spec.ts (1)
e2e/e2e-utils/src/index.ts (1)
test(7-7)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (3)
e2e/react-start/basic-spa/src/routes/not-found/route.tsx (1)
Route(4-8)
e2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsx (1)
Route(3-15)
e2e/react-start/basic-spa/src/routes/not-found/via-loader.tsx (1)
Route(3-15)
e2e/react-start/basic-spa/src/components/DefaultCatchBoundary.tsx (1)
e2e/react-start/server-routes/src/components/DefaultCatchBoundary.tsx (1)
DefaultCatchBoundary(10-53)
e2e/react-start/basic-spa/src/routes/scripts.tsx (2)
e2e/react-start/basic-spa/src/routes/inline-scripts.tsx (1)
Route(3-18)
packages/router-core/src/ssr/tsrScript.ts (1)
p(7-9)
e2e/react-start/basic-spa/src/routes/search-params/index.tsx (2)
e2e/react-start/basic-spa/src/routes/links.tsx (1)
Route(3-47)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (1)
Route(3-31)
e2e/react-start/basic-spa/tests/setup/global.setup.ts (3)
e2e/solid-router/basic-file-based/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/react-router/basic-file-based-code-splitting/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/react-router/basic/tests/setup/global.setup.ts (1)
setup(4-6)
e2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here/index.tsx (1)
e2e/react-start/basic-spa/src/routes/foo/$bar/$qux/_here.tsx (1)
Route(3-5)
e2e/react-start/basic-spa/src/routes/posts.tsx (1)
e2e/react-start/basic-spa/src/utils/posts.tsx (1)
fetchPosts(35-42)
e2e/react-start/basic-spa/src/routes/users.tsx (4)
e2e/react-start/basic-spa/src/routes/api.users.ts (1)
Route(13-28)
e2e/react-start/basic-spa/src/routes/api/users.$id.ts (1)
Route(12-32)
e2e/react-start/basic-spa/src/utils/users.tsx (1)
User(1-5)
examples/solid/start-basic/src/routes/users.tsx (1)
UsersComponent(18-48)
e2e/react-start/basic-spa/src/routes/deferred.tsx (1)
examples/solid/start-basic/src/routes/deferred.tsx (2)
Deferred(31-62)deferredStuff(19-27)
e2e/react-start/basic-spa/src/routes/redirect/$target/via-loader.tsx (2)
e2e/react-start/basic-spa/src/routes/links.tsx (1)
Route(3-47)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (1)
Route(3-31)
e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-loader.tsx (1)
e2e/react-start/basic-spa/src/components/throwRedirect.ts (1)
throwRedirect(4-23)
e2e/react-start/basic-spa/src/routes/not-found/via-beforeLoad.tsx (3)
e2e/react-start/basic-spa/src/routes/not-found/index.tsx (1)
Route(3-31)
e2e/react-start/basic-spa/src/routes/not-found/route.tsx (1)
Route(4-8)
e2e/react-start/basic-spa/src/routes/not-found/via-loader.tsx (1)
Route(3-15)
e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/via-useServerFn.tsx (1)
e2e/react-start/basic-spa/src/components/RedirectOnClick.tsx (1)
RedirectOnClick(10-26)
e2e/react-start/basic-spa/src/routes/inline-scripts.tsx (2)
e2e/react-start/basic-spa/src/routes/__root.tsx (1)
Route(16-75)
packages/router-core/src/ssr/tsrScript.ts (1)
p(7-9)
e2e/react-start/basic-spa/src/routes/api/users.$id.ts (2)
e2e/react-start/basic-spa/src/routes/api.users.ts (1)
Route(13-28)
e2e/react-start/basic-spa/src/utils/users.tsx (1)
User(1-5)
🪛 Biome (2.1.2)
e2e/react-start/basic-spa/src/routes/stream.tsx
[error] 51-51: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
e2e/react-start/basic-spa/src/routes/deferred.tsx
[error] 43-43: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
[error] 53-53: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
@@ -0,0 +1,21 @@1+{2+ "name": "tanstack-react-start-e2e-basic-spa",3+ "private": true,4+ "sideEffects": false,5+ "type": "module",6+ "scripts": {7+ "dev": "vite dev --port 3001",8+ "dev:e2e": "vite dev",9+ "build": "vite build && tsc --noEmit",10+ "start": "pnpx srvx --prod -s ../client dist/server/server.js",11+ "test:e2e": "rm -rf port*.txt; NODE_ENV=development playwright test --project=chromium"12+ },13+ "dependencies": {14+ "@tanstack/react-router": "workspace:^",15+ "@tanstack/react-router-devtools": "workspace:^",16+ "@tanstack/react-start": "workspace:^",17+ "react": "^19.0.0",18+ "react-dom": "^19.0.0",19+ "redaxios": "^0.5.1",20+ "tailwind-merge": "^2.6.0"21+ },🛠️ Refactor suggestion | 🟠 Major
Move zod to dependencies (used at runtime by routes).
zod is imported in client route code, so it must be a production dependency to avoid prod-start failures.
"dependencies": { @@ - "tailwind-merge": "^2.6.0" + "tailwind-merge": "^2.6.0", + "zod": "^3.24.2" }, "devDependencies": { @@ - "vite-tsconfig-paths": "^5.1.4", - "zod": "^3.24.2" + "vite-tsconfig-paths": "^5.1.4" }Also applies to: 22-38
🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/package.json around lines 13 to 21 (and also lines 22 to 38), zod is currently listed as a dev dependency but is imported by client route code at runtime; move the zod entry from devDependencies into dependencies so it is installed in production builds, ensuring the package.json has zod under the "dependencies" section (remove it from "devDependencies") and keep version specifier consistent with the project.✅ Addressed in commit d4af3a3
@@ -0,0 +1,17 @@1+{2+ "name": "tanstack-react-start-e2e-basic-spa",3+ "private": true,4+ "sideEffects": false,5+ "type": "module",6+ "scripts": {7+ "dev": "vite dev --port 3001",8+ "dev:e2e": "vite dev",9+ "build": "vite build && tsc --noEmit",10+ "start": "pnpx srvx --prod -s ../client dist/server/server.js",11+ "test:e2e": "rm -rf port*.txt; NODE_ENV=development playwright test --project=chromium"12+ },13+ "dependencies": {14+ "@tanstack/react-router": "workspace:^",15+ "@tanstack/react-router-devtools": "workspace:^",16+ "@tanstack/react-start": "workspace:^",17+ "react": "^19.0.0",🛠️ Refactor suggestion | 🟠 Major
Use workspace:* for internal TanStack packages.
Per repo guidelines, internal deps should use the workspace:* protocol (not workspace:^).
As per coding guidelines
- "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/react-start": "workspace:^", + "@tanstack/react-router": "workspace:*", + "@tanstack/react-router-devtools": "workspace:*", + "@tanstack/react-start": "workspace:*", @@ - "@tanstack/router-e2e-utils": "workspace:^", + "@tanstack/router-e2e-utils": "workspace:*",Also applies to: 24-24
🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/package.json around lines 14-17 (and also line 24), several internal TanStack dependencies use "workspace:^" which violates repo guidelines; replace the workspace version specifiers with the workspace:* protocol for "@tanstack/react-router", "@tanstack/react-router-devtools", "@tanstack/react-start" (and any other internal TanStack packages on line 24) so they read "workspace:*" to mark them as internal workspace dependencies.✅ Addressed in commit d4af3a3
@@ -0,0 +3,21 @@3+ "private": true,4+ "sideEffects": false,5+ "type": "module",6+ "scripts": {7+ "dev": "vite dev --port 3001",8+ "dev:e2e": "vite dev",9+ "build": "vite build && tsc --noEmit",10+ "start": "pnpx srvx --prod -s ../client dist/server/server.js",11+ "test:e2e": "rm -rf port*.txt; NODE_ENV=development playwright test --project=chromium"12+ },13+ "dependencies": {14+ "@tanstack/react-router": "workspace:^",15+ "@tanstack/react-router-devtools": "workspace:^",16+ "@tanstack/react-start": "workspace:^",17+ "react": "^19.0.0",18+ "react-dom": "^19.0.0",19+ "redaxios": "^0.5.1",20+ "tailwind-merge": "^2.6.0"21+ },22+ "devDependencies": {23+ "@playwright/test": "^1.50.1",⚠️ Potential issue | 🔴 Critical
🧩 Analysis chain
Verify Playwright version alignment across e2e packages.
Ensure @playwright/test version is consistent with other e2e fixtures to avoid cross-fixture tooling drift.
🏁 Script executed:
#!/bin/bash # List @playwright/test versions across all e2e package.json files fd package.json e2e -t f | while read -r f; do echo "== $f ==" jq -r '.devDependencies["@playwright/test"] // .dependencies["@playwright/test"] // empty' "$f" doneLength of output: 3239
Add missing @playwright/test @ ^1.50.1 across e2e fixtures The following e2e packages don’t list @playwright/test and should include it at ^1.50.1:
- e2e/e2e-utils/package.json
- e2e/react-start/basic-tsr-config/package.json
- e2e/react-start/selective-ssr/package.json
- e2e/react-start/serialization-adapters/package.json
- e2e/react-start/spa-mode/package.json
- e2e/solid-start/basic-tsr-config/package.json
- e2e/solid-start/selective-ssr/package.json
- e2e/solid-start/spa-mode/package.json
🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/package.json around line 23, the dependency list includes "@playwright/test": "^1.50.1" but several other e2e fixture package.json files are missing this dev dependency; update each of the following files to include "@playwright/test": "^1.50.1" in their dependencies or devDependencies: e2e/e2e-utils/package.json, e2e/react-start/basic-tsr-config/package.json, e2e/react-start/selective-ssr/package.json, e2e/react-start/serialization-adapters/package.json, e2e/react-start/spa-mode/package.json, e2e/solid-start/basic-tsr-config/package.json, e2e/solid-start/selective-ssr/package.json, and e2e/solid-start/spa-mode/package.json ensuring version is ^1.50.1 and run npm/yarn install or update lockfile afterward.@@ -0,0 +1,3 @@1+{2+ "name": "",3+ "short_name": "",⚠️ Potential issue | 🟡 Minor
Fill in manifest
nameandshort_name.Leaving both strings empty causes the installed PWA (or “Add to home screen”) shell to display a blank label, which is confusing and fails basic lighthouse/PWA audits. Either supply representative values (e.g. “TanStack Router SPA”) or omit the properties entirely so the browser can fall back to the document title.
🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/public/site.webmanifest around lines 2-3, the manifest's "name" and "short_name" are empty which yields blank labels in installed PWAs; populate them with representative strings (e.g., "TanStack Router SPA" and "TanStack") or remove the properties entirely so the browser falls back to the document title—update the file accordingly to ensure meaningful install labels and pass PWA audits.@@ -0,0 +31,21 @@31+ ],32+ links: [33+ { rel: 'stylesheet', href: appCss },34+ {35+ rel: 'apple-touch-icon',36+ sizes: '180x180',37+ href: '/apple-touch-icon.png',38+ },39+ {40+ rel: 'icon',41+ type: 'image/png',42+ sizes: '32x32',43+ href: '/favicon-32x32.png',44+ },45+ {46+ rel: 'icon',47+ type: 'image/png',48+ sizes: '16x16',49+ href: '/favicon-16x16.png',50+ },51+ { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },⚠️ Potential issue | 🟡 Minor
Fix hex color value (typo) or remove unsupported attr
#fffffis invalid (should be#ffffff). Also,coloris not a standard attribute forrel="manifest".- { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' }, + { rel: 'manifest', href: '/site.webmanifest' }, + // If you intended a mask icon, use: + // { rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#ffffff' },📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
{ rel: 'manifest', href: '/site.webmanifest' }, // If you intended a mask icon, use: // { rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#ffffff' },🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/__root.tsx around line 51, the manifest link uses an invalid hex color '#fffff' and a nonstandard 'color' attribute for rel="manifest"; either correct the hex to a valid six-digit value (e.g. '#ffffff') and move this value into a proper <meta name="theme-color"> tag, or simply remove the unsupported 'color' attribute from the link element so the manifest link is valid.@@ -0,0 +1,19 @@1+import { Link, Outlet, createFileRoute } from '@tanstack/react-router'2+3+export const Route = createFileRoute('/_layout/_layout-2')({4+ component: LayoutComponent,5+})6+7+function LayoutComponent() {8+ return (9+ <div>10+ <div>I'm a nested layout</div>11+ <div className="flex gap-2 border-b">12+ <Link13+ to="/layout-a"14+ activeProps={{15+ className: 'font-bold',16+ }}17+ >18+ Layout A19+ </Link>⚠️ Potential issue | 🔴 Critical
Fix Links: current absolute paths point to non-existent top-level routes.
These should link to children of "/_layout/_layout-2". Use relative paths for stability.
- <Link - to="/layout-a" + <Link + to="./layout-a" @@ - <Link - to="/layout-b" + <Link + to="./layout-b"Also applies to: 20-27
🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/_layout/_layout-2.tsx around lines 12-19 (and similarly for lines 20-27), the Link components use absolute paths like "/layout-a" which point to non-existent top-level routes; change them to relative paths that target the children of the current route (for example "./layout-a" or "layout-a") so the links resolve within "/_layout/_layout-2" instead of the app root, and update both Link instances accordingly.@@ -0,0 +8,21 @@8+if (import.meta.env.VITE_NODE_ENV === 'test') {9+ queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`10+}11+12+export const Route = createFileRoute('/api/users/$id')({13+ server: {14+ handlers: {15+ GET: async ({ request, params }) => {16+ console.info(`Fetching users by id=${params.id}... @`, request.url)17+ try {18+ const res = await axios.get<User>(`${queryURL}/users/` + params.id)19+20+ return json({21+ id: res.data.id,22+ name: res.data.name,23+ email: res.data.email,24+ })25+ } catch (e) {26+ console.error(e)27+ return json({ error: 'User not found' }, { status: 404 })28+ }⚠️ Potential issue | 🟠 Major
Don't map all upstream errors to 404; distinguish 404 from other failures.
Currently any error returns 404, masking real upstream issues. Check the HTTP status (prefer response.status) and return 404 only when appropriate; otherwise surface a 5xx.
Apply this diff:
- } catch (e) { - console.error(e) - return json({ error: 'User not found' }, { status: 404 }) - } + } catch (e: any) { + console.error(e) + const status = e?.response?.status ?? e?.status + if (status === 404) { + return json({ error: 'User not found' }, { status: 404 }) + } + return json({ error: 'Upstream error' }, { status: 502 }) + }📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
} catch (e: any) { console.error(e) const status = e?.response?.status ?? e?.status if (status === 404) { return json({ error: 'User not found' }, { status: 404 }) } return json({ error: 'Upstream error' }, { status: 502 }) }🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/api/users.$id.ts around lines 25 to 28, the catch currently maps any error to a 404; change it to inspect the error/upstream response and only return 404 when the upstream response indicates 404 (e.g., if error is a Response with error.status === 404 or if you detect a NotFound marker), otherwise log the error and return a 5xx (502 or 500) JSON response; ensure you preserve diagnostic logging and include a clear error message for non-404 failures.@@ -0,0 +34,21 @@34+35+ return (36+ <div className="p-2">37+ <div data-testid="regular-person">38+ {person.name} - {person.randomNumber}39+ </div>40+ <Suspense fallback={<div>Loading person...</div>}>41+ <Await42+ promise={deferredPerson}43+ children={(data) => (44+ <div data-testid="deferred-person">45+ {data.name} - {data.randomNumber}46+ </div>47+ )}48+ />49+ </Suspense>50+ <Suspense fallback={<div>Loading stuff...</div>}>51+ <Await52+ promise={deferredStuff}53+ children={(data) => <h3 data-testid="deferred-stuff">{data}</h3>}54+ />⚠️ Potential issue | 🟠 Major
Fix
<Await>usage to unblock lint errorsThe lint rule
noChildrenPropflags both<Await>calls because we're passing the render function via thechildrenprop. Switching to the standard JSX children form clears the errors and matches the rest of the codebase.[ suggest_essential_refactor ] ← Wait can't both? we need to ensure bracket combination. Lint has to be essential. Actually instructions: tags choose. we can't add both raise major issue and suggest essential? maybe we can but instructions? not restricted but ensure we choose correct. Should we keep only raise_major_issue? you can't mix with suggestion? I need to read instructions: For each comment must have at least one category tag; can append multiple if necessary. We can include both raise_major_issue and suggest_essential_refactor? but essential refactor maybe redundant. I'll keep raise_major_issue only? Maybe we just use raise_major_issue. We'll adjust.
But need "Based on static analysis" mention.
Let's restructure comment.
Fix
<Await>usage to unblock lint errors@tanstack/react-router's<Await>expects the render callback as JSX children. Passing it through thechildrenprop triggers thenoChildrenProplint error, so CI will fail until we switch to the canonical syntax.Based on static analysis.
Apply this diff:
<Suspense fallback={<div>Loading person...</div>}> - <Await - promise={deferredPerson} - children={(data) => ( - <div data-testid="deferred-person"> - {data.name} - {data.randomNumber} - </div> - )} - /> + <Await promise={deferredPerson}> + {(data) => ( + <div data-testid="deferred-person"> + {data.name} - {data.randomNumber} + </div> + )} + </Await> </Suspense> <Suspense fallback={<div>Loading stuff...</div>}> - <Await - promise={deferredStuff} - children={(data) => <h3 data-testid="deferred-stuff">{data}</h3>} - /> + <Await promise={deferredStuff}> + {(data) => <h3 data-testid="deferred-stuff">{data}</h3>} + </Await> </Suspense>📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<Suspense fallback={<div>Loading person...</div>}> <Await promise={deferredPerson}> {(data) => ( <div data-testid="deferred-person"> {data.name} - {data.randomNumber} </div> )} </Await> </Suspense> <Suspense fallback={<div>Loading stuff...</div>}> <Await promise={deferredStuff}> {(data) => <h3 data-testid="deferred-stuff">{data}</h3>} </Await> </Suspense>🧰 Tools
🪛 Biome (2.1.2)
[error] 43-43: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
[error] 53-53: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
🤖 Prompt for AI Agents
e2e/react-start/basic-spa/src/routes/deferred.tsx around lines 41 to 54: the two <Await> usages pass render callbacks via the children prop which triggers the noChildrenProp lint rule; replace each children={...} prop by moving the render function into the JSX children position (i.e., open <Await promise={...}> renderCallback </Await>), keeping the same render function body and testid attributes so behavior is unchanged and lint errors are resolved.@@ -0,0 +1,10 @@1+import { Link, createFileRoute } from '@tanstack/react-router'2+3+export const Route = createFileRoute('/links')({4+ component: () => {5+ const navigate = Route.useNavigate()6+ return (7+ <div>8+ <h1 className="mb-4 text-4xl font-extrabold lmd:text-5xl lg:text-6xl ">9+ link test10+ </h1>⚠️ Potential issue | 🟡 Minor
Fix the Tailwind breakpoint typo.
lmd:text-5xlisn’t a valid Tailwind breakpoint, so the heading never scales at the medium breakpoint. Swap it formd:text-5xl.- <h1 className="mb-4 text-4xl font-extrabold lmd:text-5xl lg:text-6xl "> + <h1 className="mb-4 text-4xl font-extrabold md:text-5xl lg:text-6xl ">📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<h1 className="mb-4 text-4xl font-extrabold md:text-5xl lg:text-6xl "> link test </h1>🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/links.tsx around lines 8 to 10, the Tailwind class `lmd:text-5xl` is a typo; replace it with the correct breakpoint class `md:text-5xl` so the heading scales at the medium breakpoint.@@ -0,0 +1,7 @@1+import { createFileRoute } from '@tanstack/react-router'2+import z from 'zod'3+4+export const Route = createFileRoute('/not-found')({5+ validateSearch: z.object({6+ preload: z.literal(false).optional(),7+ }),⚠️ Potential issue | 🔴 Critical
Fix zod import to avoid runtime crash.
import z from 'zod'resolves toundefinedat runtime because Zod has no default export. When this file loads,z.objectthrows, breaking the route. Switch to the named import.-import z from 'zod' +import { z } from 'zod'📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { createFileRoute } from '@tanstack/react-router' import { z } from 'zod' export const Route = createFileRoute('/not-found')({ validateSearch: z.object({ preload: z.literal(false).optional(), }),🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/not-found/route.tsx lines 1-7, the file imports Zod with a default import which is undefined at runtime; replace the default import with a named import from Zod (e.g., change the import to use the named export for z) so that z.object and other Zod APIs work at runtime, keeping the rest of the file intact.✅ Addressed in commit d4af3a3
@@ -0,0 +13,21 @@13+ },14+})15+16+export function PostErrorComponent({ error }: ErrorComponentProps) {17+ return <ErrorComponent error={error} />18+}19+20+function PostComponent() {21+ const post = Route.useLoaderData()22+23+ return (24+ <div className="space-y-2">25+ <h4 className="text-xl font-bold underline">{post.title}</h4>26+ <div className="text-sm">{post.body}</div>27+ <Link28+ to="/posts/$postId/deep"29+ params={{30+ postId: post.id,31+ }}32+ activeProps={{ className: 'text-black font-bold' }}33+ className="inline-block py-1 text-blue-800 hover:text-blue-600"⚠️ Potential issue | 🔴 Critical
Param type mismatch: ensure postId is a string
Route params are strings;
post.idis likely a number (see fetchPost usage). This will fail type-checking in strict TS and can cause route matching issues. Convert to string.[ suggest_essential_refactor ] As per coding guidelines (TypeScript strict mode), apply:
params={{ - postId: post.id, + postId: String(post.id), }}Alternative: if you already have the param from the parent route, reuse that string param instead of the loader data’s numeric id.
📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
to="/posts/$postId/deep" params={{ postId: String(post.id), }} activeProps={{ className: 'text-black font-bold' }} className="inline-block py-1 text-blue-800 hover:text-blue-600"🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/posts.$postId.tsx around lines 28 to 33, the Link params are passing post.id which is likely a number while route params must be strings; convert the id to a string (e.g., use post.id.toString() or String(post.id>) before assigning to params) or, alternatively, reuse the existing string postId param from the parent route instead of the numeric loader value so TypeScript strict mode and route matching remain correct.@@ -0,0 +16,21 @@16+17+function PostsComponent() {18+ const posts = Route.useLoaderData()19+20+ return (21+ <div className="p-2 flex gap-2">22+ <ul className="list-disc pl-4">23+ {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(24+ (post) => {25+ return (26+ <li key={post.id} className="whitespace-nowrap">27+ <Link28+ to="/posts/$postId"29+ params={{30+ postId: post.id,31+ }}32+ className="block py-1 text-blue-800 hover:text-blue-600"33+ activeProps={{ className: 'text-black font-bold' }}34+ >35+ <div>{post.title.substring(0, 20)}</div>36+ </Link>🛠️ Refactor suggestion | 🟠 Major
Ensure route param is a string
Route params are strings; casting avoids strict-mode/type issues if
post.idis numeric.- params={{ - postId: post.id, - }} + params={{ postId: String(post.id) }}📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
to="/posts/$postId" params={{ postId: String(post.id) }} className="block py-1 text-blue-800 hover:text-blue-600" activeProps={{ className: 'text-black font-bold' }} > <div>{post.title.substring(0, 20)}</div> </Link>🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/posts.tsx around lines 28 to 36, the route params object passes post.id directly which can be numeric; convert the id to a string (e.g., String(post.id) or post.id.toString()) before assigning to params.postId so route param types remain string-safe and avoid strict-mode/type issues.@@ -0,0 +1,3 @@1+import { createFileRoute, retainSearchParams } from '@tanstack/react-router'2+import z from 'zod'3+⚠️ Potential issue | 🔴 Critical
Fix incorrect zod import (will fail at runtime)
zod has no default export. Using
import z from 'zod'will be undefined at runtime. Use named import or namespace import.Apply this diff:
-import z from 'zod' +import { z } from 'zod'Optional alternative:
- target: z.union([z.literal('internal'), z.literal('external')]), + target: z.enum(['internal', 'external']),📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { createFileRoute, retainSearchParams } from '@tanstack/react-router' import { z } from 'zod'🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/redirect/$target.tsx around lines 1-3, the module imports zod using a default import which is undefined at runtime; replace the default import with a valid named or namespace import (for example use "import { z } from 'zod'" or "import * as z from 'zod'") and update any usage to match the chosen import style.✅ Addressed in commit d4af3a3
@@ -0,0 +1 @@1+import { createFileRoute, retainSearchParams } from '@tanstack/react-router'🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Search for other default imports of zod
Ensure no other files import zod as default.
🏁 Script executed:
#!/bin/bash # Find incorrect default imports of zod across the repo rg -nP --type=ts --type=tsx $'import\\s+z\\s+from\\s*[\'"]zod[\'"]'Length of output: 27
🏁 Script executed:
#!/bin/bash # Search for default imports of zod in .ts and .tsx files without relying on built-in types rg -nP 'import\s+z\s+from\s+["'\'']zod["'\'']' -g '*.ts' -g '*.tsx'Length of output: 1115
Replace all default imports of zod with named imports Instances of
import z from 'zod'appear across the codebase (e.g. in examples/react/start-material-ui/src/routes/index.tsx, e2e//src/routes//*.tsx); update each to:
import { z } from 'zod'🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/redirect/$target.tsx around line 1, change any occurrence of a default import "import z from 'zod'" to a named import "import { z } from 'zod'"; scan the file (and other files flagged) and update their import statements accordingly, ensuring you remove the default import and replace it with the named import while leaving any z usage unchanged.✅ Addressed in commit d4af3a3
@@ -0,0 +1,8 @@1+import { Link, createFileRoute } from '@tanstack/react-router'2+3+export const Route = createFileRoute('/redirect/$target/serverFn/')({4+ component: () => (5+ <div>6+ <h1 className="mb-4 text-4xl font-extrabold lmd:text-5xl lg:text-6xl ">7+ redirect test with server functions (target {Route.useParams().target})8+ </h1>⚠️ Potential issue | 🟡 Minor
Fix likely Tailwind typo:
lmd:→md:lmd:isn’t a standard breakpoint; this looks unintended.Apply this diff:
- <h1 className="mb-4 text-4xl font-extrabold lmd:text-5xl lg:text-6xl "> + <h1 className="mb-4 text-4xl font-extrabold md:text-5xl lg:text-6xl ">📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<h1 className="mb-4 text-4xl font-extrabold md:text-5xl lg:text-6xl "> redirect test with server functions (target {Route.useParams().target}) </h1>🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/index.tsx around lines 6 to 8, the Tailwind breakpoint class "lmd:text-5xl" is a typo; replace "lmd:" with the correct "md:" so the class becomes "md:text-5xl" to use the standard medium breakpoint.✅ Addressed in commit d4af3a3
@@ -0,0 +1,16 @@1+import { createFileRoute, redirect } from '@tanstack/react-router'2+3+export const Route = createFileRoute('/redirect/$target/via-beforeLoad')({4+ beforeLoad: ({5+ params: { target },6+ search: { reloadDocument, externalHost },7+ }) => {8+ switch (target) {9+ case 'internal':10+ throw redirect({ to: '/posts', reloadDocument })11+ case 'external':12+ throw redirect({ href: externalHost })13+ }14+ },15+ component: () => <div>{Route.fullPath}</div>,16+})⚠️ Potential issue | 🟠 Major
Prevent invalid external redirect and validate search
If
externalHostis absent or malformed,redirect({ href: externalHost })can be invalid. Add search validation and a safe fallback.-import { createFileRoute, redirect } from '@tanstack/react-router' +import { createFileRoute, redirect } from '@tanstack/react-router' +import { z } from 'zod' export const Route = createFileRoute('/redirect/$target/via-beforeLoad')({ + validateSearch: z.object({ + reloadDocument: z.boolean().optional(), + externalHost: z.string().url().optional(), + }), beforeLoad: ({ params: { target }, search: { reloadDocument, externalHost }, }) => { switch (target) { case 'internal': throw redirect({ to: '/posts', reloadDocument }) case 'external': - throw redirect({ href: externalHost }) + throw redirect({ href: externalHost ?? 'http://example.com' }) } }, component: () => <div>{Route.fullPath}</div>, })📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { createFileRoute, redirect } from '@tanstack/react-router' import { z } from 'zod' export const Route = createFileRoute('/redirect/$target/via-beforeLoad')({ validateSearch: z.object({ reloadDocument: z.boolean().optional(), externalHost: z.string().url().optional(), }), beforeLoad: ({ params: { target }, search: { reloadDocument, externalHost }, }) => { switch (target) { case 'internal': throw redirect({ to: '/posts', reloadDocument }) case 'external': throw redirect({ href: externalHost ?? 'http://example.com' }) } }, component: () => <div>{Route.fullPath}</div>, })🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/redirect/$target/via-beforeLoad.tsx around lines 3–16, the beforeLoad handler blindly calls redirect({ href: externalHost }) which can produce an invalid external redirect when externalHost is missing or malformed; validate that externalHost exists and is a well-formed absolute URL (e.g., parse with URL or check it starts with http:// or https://) before calling redirect to it, and if validation fails fall back to a safe internal redirect such as redirect({ to: '/posts', reloadDocument }) (or throw a controlled error); ensure you still handle the 'internal' case and preserve reloadDocument handling.@@ -0,0 +25,21 @@25+26+function Home() {27+ const { promise, stream } = Route.useLoaderData()28+ const [streamData, setStreamData] = useState<Array<string>>([])29+30+ useEffect(() => {31+ async function fetchStream() {32+ const reader = stream.getReader()33+ let chunk34+35+ while (!(chunk = await reader.read()).done) {36+ let value = chunk.value37+ if (typeof value !== 'string') {38+ value = decoder.decode(value, { stream: !chunk.done })39+ }40+ setStreamData((prev) => [...prev, value])41+ }42+ }43+44+ fetchStream()45+ }, [])⚠️ Potential issue | 🟠 Major
Re-run the stream reader when loader data changes.
With an empty dependency array the effect only runs on the first mount. When the loader revalidates (e.g. SPA navigation or param change) it yields a new
ReadableStream, but the existing effect never re-subscribes, so the UI keeps showing stale data. Addstreamas a dependency, reset state for the new stream, and guard against updates after unmount. A cleanup that marks the reader as cancelled (or cancels it) also prevents state updates on an unmounted component.- useEffect(() => { - async function fetchStream() { - const reader = stream.getReader() - let chunk - - while (!(chunk = await reader.read()).done) { - let value = chunk.value - if (typeof value !== 'string') { - value = decoder.decode(value, { stream: !chunk.done }) - } - setStreamData((prev) => [...prev, value]) - } - } - - fetchStream() - }, []) + useEffect(() => { + let cancelled = false + setStreamData([]) + + async function fetchStream() { + const reader = stream.getReader() + let chunk + + try { + while (!(chunk = await reader.read()).done) { + let value = chunk.value + if (typeof value !== 'string') { + value = decoder.decode(value, { stream: true }) + } + if (!cancelled) { + setStreamData((prev) => [...prev, value]) + } + } + } finally { + reader.releaseLock() + } + } + + fetchStream() + + return () => { + cancelled = true + } + }, [stream])📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
useEffect(() => { let cancelled = false setStreamData([]) async function fetchStream() { const reader = stream.getReader() let chunk try { while (!(chunk = await reader.read()).done) { let value = chunk.value if (typeof value !== 'string') { value = decoder.decode(value, { stream: true }) } if (!cancelled) { setStreamData((prev) => [...prev, value]) } } } finally { reader.releaseLock() } } fetchStream() return () => { cancelled = true } }, [stream])🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/stream.tsx around lines 30 to 45, the useEffect currently only runs on mount so it never re-subscribes when the loader yields a new ReadableStream; update the effect to include `stream` in the dependency array, reset stream state when a new stream arrives (e.g., setStreamData([]) before reading), and in the effect create a cancelled flag and/or call reader.cancel() in the cleanup to prevent setState after unmount or when the stream changes; ensure you obtain the reader inside the effect and only call setStreamData while not cancelled.✅ Addressed in commit d4af3a3
@@ -0,0 +41,21 @@41+ }42+ }43+44+ fetchStream()45+ }, [])46+47+ return (48+ <>49+ <Await50+ promise={promise}51+ children={(promiseData) => (52+ <div className="p-2" data-testid="promise-data">53+ {promiseData}54+ <div data-testid="stream-data">55+ {streamData.map((d) => (56+ <div key={d}>{d}</div>57+ ))}58+ </div>59+ </div>60+ )}61+ />⚠️ Potential issue | 🟠 Major
Use JSX children for
<Await>instead of thechildrenprop.Passing the render function via the
childrenprop triggers the BiomenoChildrenProprule and will fail linting. Wrap the function as regular JSX children instead.- <Await - promise={promise} - children={(promiseData) => ( + <Await promise={promise}> + {(promiseData) => ( <div className="p-2" data-testid="promise-data"> {promiseData} <div data-testid="stream-data"> {streamData.map((d) => ( <div key={d}>{d}</div> ))} </div> </div> - )} - /> + )} + </Await>📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<Await promise={promise}> {(promiseData) => ( <div className="p-2" data-testid="promise-data"> {promiseData} <div data-testid="stream-data"> {streamData.map((d) => ( <div key={d}>{d}</div> ))} </div> </div> )} </Await>🧰 Tools
🪛 Biome (2.1.2)
[error] 51-51: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/stream.tsx around lines 49 to 61, the Await usage passes a render function via the children prop which violates the Biome noChildrenProp rule; change it to use regular JSX children by removing the children prop and placing the render function as the inner JSX between <Await ...> and </Await> (e.g., <Await promise={promise}>{(promiseData)=> ( ... )}</Await>), preserving the existing markup and data-testid attributes.@@ -0,0 +1 @@1+import { ErrorComponent, createFileRoute } from '@tanstack/react-router'🛠️ Refactor suggestion | 🟠 Major
Import
notFoundfrom the routerNeeded for the 404 pathway suggested above.
-import { ErrorComponent, createFileRoute } from '@tanstack/react-router' +import { ErrorComponent, createFileRoute, notFound } from '@tanstack/react-router'📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { ErrorComponent, createFileRoute, notFound } from '@tanstack/react-router'🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/users.$userId.tsx around line 1, the import statement only pulls ErrorComponent and createFileRoute but is missing the notFound export needed for the 404 pathway; update the import to include notFound (e.g., add notFound to the named imports from '@tanstack/react-router') and then use that notFound export in the route logic where the 404 handling is implemented.e2e/react-start/basic-spa/src/routes/users.$userId.tsx lines 9 to 16Outdated@@ -0,0 +1,16 @@1+import { ErrorComponent, createFileRoute } from '@tanstack/react-router'2+import axios from 'redaxios'3+import type { ErrorComponentProps } from '@tanstack/react-router'4+5+import type { User } from '~/utils/users'6+import { NotFound } from '~/components/NotFound'7+8+export const Route = createFileRoute('/users/$userId')({9+ loader: async ({ params: { userId } }) => {10+ return await axios11+ .get<User>('/api/users/' + userId)12+ .then((r) => r.data)13+ .catch(() => {14+ throw new Error('Failed to fetch user')15+ })16+ },⚠️ Potential issue | 🟠 Major
Throw
notFound()on 404 sonotFoundComponentcan renderCatching all errors and rethrowing a generic Error prevents the
notFoundComponentfrom ever being used on 404s. Detect 404 and thrownotFound(); otherwise rethrow a generic error. Also simplify totry/catchinstead of mixingawaitwith.then/.catch.- loader: async ({ params: { userId } }) => { - return await axios - .get<User>('/api/users/' + userId) - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch user') - }) - }, + loader: async ({ params: { userId } }) => { + try { + const { data } = await axios.get<User>(`/api/users/${userId}`) + return data + } catch (e: any) { + const status = e?.status ?? e?.response?.status + if (status === 404) { + throw notFound() + } + throw new Error('Failed to fetch user') + } + },📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
loader: async ({ params: { userId } }) => { try { const { data } = await axios.get<User>(`/api/users/${userId}`) return data } catch (e: any) { const status = e?.status ?? e?.response?.status if (status === 404) { throw notFound() } throw new Error('Failed to fetch user') } },e2e/react-start/basic-spa/src/utils/posts.tsx lines 5 to 9Outdated@@ -0,0 +1,9 @@1+import { notFound } from '@tanstack/react-router'2+import { createServerFn } from '@tanstack/react-start'3+import axios from 'redaxios'4+5+export type PostType = {6+ id: string7+ title: string8+ body: string9+}⚠️ Potential issue | 🟠 Major
Fix type: PostType.id should be a number (matches API and User.id).
JSONPlaceholder returns numeric ids; using string hides mismatches and weakens type safety.
export type PostType = { - id: string + id: number title: string body: string }📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export type PostType = { id: number title: string body: string }🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/utils/posts.tsx around lines 5 to 9, PostType currently declares id as a string but the API and User.id use numeric ids; change PostType.id to number and update any code, callers, and tests that assume a string id (parsing, comparisons, props) to treat id as a number (or coerce API strings to numbers), ensuring all type imports/usages remain consistent across the codebase.e2e/react-start/basic-spa/src/utils/posts.tsx lines 21 to 30Outdated@@ -0,0 +10,21 @@10+11+let queryURL = 'https://jsonplaceholder.typicode.com'12+13+if (import.meta.env.VITE_NODE_ENV === 'test') {14+ queryURL = `http://localhost:${import.meta.env.VITE_EXTERNAL_PORT}`15+}16+17+export const fetchPost = createServerFn({ method: 'GET' })18+ .inputValidator((postId: string) => postId)19+ .handler(async ({ data: postId }) => {20+ console.info(`Fetching post with id ${postId}...`)21+ const post = await axios22+ .get<PostType>(`${queryURL}/posts/${postId}`)23+ .then((r) => r.data)24+ .catch((err) => {25+ console.error(err)26+ if (err.status === 404) {27+ throw notFound()28+ }29+ throw err30+ })⚠️ Potential issue | 🟠 Major
Robust 404 detection for axios/redaxios errors.
Error.status may not be set; prefer response.status and only map 404 to notFound, rethrow others.
- .catch((err) => { + .catch((err: any) => { console.error(err) - if (err.status === 404) { + const status = err?.response?.status ?? err?.status + if (status === 404) { throw notFound() } throw err })📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const post = await axios .get<PostType>(`${queryURL}/posts/${postId}`) .then((r) => r.data) .catch((err: any) => { console.error(err) const status = err?.response?.status ?? err?.status if (status === 404) { throw notFound() } throw err })🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/utils/posts.tsx around lines 21 to 30, the axios error handler incorrectly checks err.status which may be undefined; update the catch to inspect err.response?.status (or err.response && err.response.status) and only call throw notFound() when that status === 404, otherwise rethrow the original error so non-404 errors propagate unchanged.@@ -0,0 +1,9 @@1+export type User = {2+ id: number3+ name: string4+ email: string5+}6+7+const PORT = process.env.VITE_SERVER_PORT || 30008+9+export const DEPLOY_URL = `http://localhost:${PORT}`⚠️ Potential issue | 🟠 Major
Use Vite’s import.meta.env (with a safe fallback) instead of process.env in client code.
In Vite, env vars are exposed via import.meta.env; process.env may be undefined in the browser.
Apply this diff:
-const PORT = process.env.VITE_SERVER_PORT || 3000 - -export const DEPLOY_URL = `http://localhost:${PORT}` +const PORT = + (typeof import.meta !== 'undefined' && + (import.meta as any).env?.VITE_SERVER_PORT) ?? + (typeof process !== 'undefined' && process.env?.VITE_SERVER_PORT) ?? + '3000' + +export const DEPLOY_URL = `http://localhost:${String(PORT)}`🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/utils/users.tsx around lines 7 to 9, the code uses process.env in client-side code which may be undefined in the browser; replace the use of process.env.VITE_SERVER_PORT with import.meta.env.VITE_SERVER_PORT and provide a safe fallback to 3000 (e.g., use a nullish-coalescing fallback) and then build DEPLOY_URL from that PORT value so the client reads Vite-exposed env vars correctly.@@ -0,0 +44,21 @@44+45+ await page.getByRole('link', { name: 'Layout A' }).click()46+ await page.waitForLoadState('networkidle')47+ await expect(page.locator('body')).toContainText("I'm layout A!")48+49+ await page.getByRole('link', { name: 'Layout B' }).click()50+ await page.waitForLoadState('networkidle')51+ await expect(page.locator('body')).toContainText("I'm layout B!")52+})53+54+test('client side navigating to a route with scripts', async ({ page }) => {55+ await page.goto('/')56+ await page.waitForURL('/')57+ await page.getByRole('link', { name: 'Scripts', exact: true }).click()58+ await page.waitForURL('/scripts')59+ await expect(page.getByTestId('scripts-test-heading')).toBeInViewport()60+ await page.waitForLoadState('networkidle')61+ expect(await page.evaluate('window.SCRIPT_1')).toBe(true)62+ expect(await page.evaluate('window.SCRIPT_2')).toBe(63+ process.env.NODE_ENV === 'development' ? true : undefined,64+ )⚠️ Potential issue | 🟠 Major
Avoid coupling to test runner NODE_ENV; assert script2 based on actual DOM/script presence.
process.env.NODE_ENV reflects the test process, not the app build mode, causing false failures. Detect whether script2 is included and assert accordingly.
- expect(await page.evaluate('window.SCRIPT_2')).toBe( - process.env.NODE_ENV === 'development' ? true : undefined, - ) + const hasScript2 = await page.evaluate( + () => !!document.querySelector('script[src*="script2.js"]'), + ) + expect(await page.evaluate('window.SCRIPT_2')).toBe( + hasScript2 ? true : undefined, + )- expect(await page.evaluate('window.SCRIPT_2')).toBe( - process.env.NODE_ENV === 'development' ? true : undefined, - ) + const hasScript2 = await page.evaluate( + () => !!document.querySelector('script[src*="script2.js"]'), + ) + expect(await page.evaluate('window.SCRIPT_2')).toBe( + hasScript2 ? true : undefined, + )Also applies to: 71-74
🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/tests/navigation.spec.ts around lines 61-64 (and similarly lines 71-74), the test currently uses process.env.NODE_ENV to decide the expected value of window.SCRIPT_2; replace that coupling with an assertion based on the actual DOM/script presence. Change the expectation to first evaluate in the page whether the script element exists (e.g. document.querySelector for the script's id/src or check typeof window.SCRIPT_2 !== 'undefined') and then assert that window.SCRIPT_2 is true only if that presence check returns true, otherwise assert it is undefined; apply the same DOM-presence-based pattern to the other block at lines 71-74.@@ -0,0 +76,21 @@76+ reloadDocument: [false, true] as const,77+ })78+79+ internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => {80+ if (process.env.NODE_ENV === 'development') {81+ test.use({82+ whitelistErrors: [83+ /A tree hydrated but some attributes of the server rendered HTML/,84+ ],85+ })86+ }87+ test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({88+ page,89+ }) => {90+ await page.goto(`/redirect/internal/via-${thrower}`)91+ await page.waitForURL(`/redirect/internal/via-${thrower}`)92+ await page.waitForLoadState('networkidle')93+94+ const url = `http://localhost:${PORT}/posts`95+96+ await page.waitForURL(url)⚠️ Potential issue | 🔴 Critical
Remove redundant waitForURL that races with immediate redirect
After
page.goto('/redirect/internal/via-…')the app redirects to/posts, so waiting for the intermediate URL will time out and flake.- await page.goto(`/redirect/internal/via-${thrower}`) - await page.waitForURL(`/redirect/internal/via-${thrower}`) - await page.waitForLoadState('networkidle') + await page.goto(`/redirect/internal/via-${thrower}`) + // Route immediately redirects; wait for idle before asserting final URL. + await page.waitForLoadState('networkidle')📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
await page.goto(`/redirect/internal/via-${thrower}`) // Route immediately redirects; wait for idle before asserting final URL. await page.waitForLoadState('networkidle') const url = `http://localhost:${PORT}/posts` await page.waitForURL(url)🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/tests/redirect.spec.ts around lines 90 to 96, the test calls page.goto('/redirect/internal/via-${thrower}') then waits for the intermediate URL which immediately redirects to /posts and causes a race/flake; remove the redundant await page.waitForURL(`/redirect/internal/via-${thrower}`) (or replace it with waiting for the final URL) so the test only waits for the actual redirected destination (e.g., await page.waitForURL(`http://localhost:${PORT}/posts`) or equivalent) and avoid racing with the immediate redirect.✅ Addressed in commits 84537b7 to 23c053c
@@ -0,0 +1,14 @@1+import { expect } from '@playwright/test'2+import { test } from '@tanstack/router-e2e-utils'3+import type { Response } from '@playwright/test'4+5+function expectRedirect(response: Response | null, endsWith: string) {6+ expect(response).not.toBeNull()7+ expect(response!.request().redirectedFrom()).not.toBeNull()8+ const redirectUrl = response!9+ .request()10+ .redirectedFrom()!11+ .redirectedTo()12+ ?.url()13+ expect(redirectUrl).toBeDefined()14+ expect(redirectUrl!.endsWith(endsWith))⚠️ Potential issue | 🔴 Critical
Missing assertion matchers — expectations are not asserting
These expects lack a matcher and won’t assert anything.
Apply this diff:
- expect(redirectUrl!.endsWith(endsWith)) + expect(redirectUrl!.endsWith(endsWith)).toBeTruthy() @@ - expect(page.url().endsWith('/search-params/loader-throws-redirect?step=a')) + expect( + page.url().endsWith('/search-params/loader-throws-redirect?step=a'), + ).toBeTruthy() @@ - expect(page.url().endsWith('/search-params/loader-throws-redirect?step=b')) + expect( + page.url().endsWith('/search-params/loader-throws-redirect?step=b'), + ).toBeTruthy()Also applies to: 35-35, 46-46
🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/tests/search-params.spec.ts around lines 14, 35 and 46 the expect calls are missing matchers and thus do not assert anything; update each to include an assertion matcher (for example change expect(redirectUrl!.endsWith(endsWith)) to expect(redirectUrl!.endsWith(endsWith)).toBeTruthy() or .toBe(true)) so the tests actually validate the condition.✅ Addressed in commit d4af3a3
@@ -0,0 +1,21 @@1+import { expect } from '@playwright/test'2+import { test } from '@tanstack/router-e2e-utils'3+import type { Response } from '@playwright/test'4+5+function expectRedirect(response: Response | null, endsWith: string) {6+ expect(response).not.toBeNull()7+ expect(response!.request().redirectedFrom()).not.toBeNull()8+ const redirectUrl = response!9+ .request()10+ .redirectedFrom()!11+ .redirectedTo()12+ ?.url()13+ expect(redirectUrl).toBeDefined()14+ expect(redirectUrl!.endsWith(endsWith))15+}16+17+function expectNoRedirect(response: Response | null) {18+ expect(response).not.toBeNull()19+ const request = response!.request()20+ expect(request.redirectedFrom()?.redirectedTo() === request).toBeTruthy21+}⚠️ Potential issue | 🔴 Critical
Incorrect “no redirect” assertion and missing matcher
For no redirect,
request.redirectedFrom()should be null. The current check is wrong and.toBeTruthyisn’t invoked.Apply this diff:
function expectNoRedirect(response: Response | null) { expect(response).not.toBeNull() const request = response!.request() - expect(request.redirectedFrom()?.redirectedTo() === request).toBeTruthy + expect(request.redirectedFrom()).toBeNull() }📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
function expectNoRedirect(response: Response | null) { expect(response).not.toBeNull() const request = response!.request() expect(request.redirectedFrom()).toBeNull() }🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/tests/search-params.spec.ts around lines 17 to 21, the "no redirect" assertion is incorrect and the matcher is not invoked; replace the current check with an explicit assertion that request.redirectedFrom() is null and ensure the matcher is called (e.g., expect(request.redirectedFrom()).toBeNull()), keep the existing null check for response and retrieving request, and remove the incorrect redirectedFrom()?.redirectedTo() comparison.Actionable comments posted: 1
🧹 Nitpick comments (1)
e2e/react-start/basic-spa/tests/redirect.spec.ts (1)
79-100: Keep the dev-only whitelist scoped to the direct-visit suiteLine 82 calls
test.useinside the loop; because Playwright keeps those settings for every test declared after that call, the hydration warning gets whitelisted for the rest of this file whenever NODE_ENV isdevelopment, hiding real regressions in later suites. Please wrap these direct-visit tests in their owntest.describeand apply the whitelist there so other tests still surface unexpected hydration errors.- internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => { - if (process.env.NODE_ENV === 'development') { - test.use({ - whitelistErrors: [ - /A tree hydrated but some attributes of the server rendered HTML/, - ], - }) - } - test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({ - page, - }) => { - await page.goto(`/redirect/internal/via-${thrower}`) - await page.waitForLoadState('networkidle') - - const url = `http://localhost:${PORT}/posts` - - await page.waitForURL(url) - expect(page.url()).toBe(url) - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport() - }) - }) + test.describe('internal direct visit', () => { + if (process.env.NODE_ENV === 'development') { + test.use({ + whitelistErrors: [ + /A tree hydrated but some attributes of the server rendered HTML/, + ], + }) + } + + internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => { + test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({ + page, + }) => { + await page.goto(`/redirect/internal/via-${thrower}`) + await page.waitForLoadState('networkidle') + + const url = `http://localhost:${PORT}/posts` + + await page.waitForURL(url) + expect(page.url()).toBe(url) + await page.waitForLoadState('networkidle') + await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport() + }) + }) + })📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between ed0ec2446730aa5282953030356eb7e873dae5c1 and b391c506daf31d38a56b56bc48bcf863c26b687b.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (8)
e2e/react-start/basic-spa/package.json(1 hunks)e2e/react-start/basic-spa/src/routes/__root.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/not-found/route.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/index.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/stream.tsx(1 hunks)e2e/react-start/basic-spa/tests/redirect.spec.ts(1 hunks)e2e/react-start/basic-spa/tests/search-params.spec.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- e2e/react-start/basic-spa/src/routes/redirect/$target.tsx
- e2e/react-start/basic-spa/tests/search-params.spec.ts
- e2e/react-start/basic-spa/package.json
- e2e/react-start/basic-spa/src/routes/redirect/$target/serverFn/index.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/react-start/basic-spa/src/routes/__root.tsxe2e/react-start/basic-spa/src/routes/not-found/route.tsxe2e/react-start/basic-spa/tests/redirect.spec.tse2e/react-start/basic-spa/src/routes/stream.tsx
**/src/routes/**
📄 CodeRabbit inference engine (AGENTS.md)
Place file-based routes under src/routes/ directories
Files:
e2e/react-start/basic-spa/src/routes/__root.tsxe2e/react-start/basic-spa/src/routes/not-found/route.tsxe2e/react-start/basic-spa/src/routes/stream.tsx
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/react-start/basic-spa/src/routes/__root.tsxe2e/react-start/basic-spa/src/routes/not-found/route.tsxe2e/react-start/basic-spa/tests/redirect.spec.tse2e/react-start/basic-spa/src/routes/stream.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx:3-5 Timestamp: 2025-09-22T00:56:49.237Z Learning: In TanStack Router, underscores are intentionally stripped from route segments (e.g., `$baz_` becomes `baz` in generated types) but should be preserved in base path segments. This is the correct behavior as of the fix in PR #5182.Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts:167-172 Timestamp: 2025-09-22T00:56:53.426Z Learning: In TanStack Router, underscores are intentionally stripped from route segments during path parsing, but preserved in base path segments. This is the expected behavior implemented in PR #5182.📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/Applied to files:
e2e/react-start/basic-spa/src/routes/__root.tsx
🧬 Code graph analysis (4)
e2e/react-start/basic-spa/src/routes/__root.tsx (3)
e2e/react-start/basic-spa/src/utils/seo.ts (1)
seo(1-33)
e2e/react-start/basic-spa/src/components/DefaultCatchBoundary.tsx (1)
DefaultCatchBoundary(10-53)
e2e/react-start/basic-spa/src/components/NotFound.tsx (1)
NotFound(3-25)
e2e/react-start/basic-spa/src/routes/not-found/route.tsx (2)
e2e/react-start/basic-spa/src/routes/__root.tsx (1)
Route(16-75)
e2e/react-start/basic-spa/src/routes/redirect/$target.tsx (1)
Route(4-21)
e2e/react-start/basic-spa/tests/redirect.spec.ts (1)
e2e/react-start/basic/tests/redirect.spec.ts (2)
internalNavigationTestMatrix(17-208)test(132-168)
e2e/react-start/basic-spa/src/routes/stream.tsx (1)
e2e/react-start/basic-spa/src/routes/deferred.tsx (1)
Route(18-29)
🪛 Biome (2.1.2)
e2e/react-start/basic-spa/src/routes/stream.tsx
[error] 64-64: Avoid passing children using a prop
The canonical way to pass children in React is to use JSX elements
(lint/correctness/noChildrenProp)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
🔇 Additional comments (2)
e2e/react-start/basic-spa/src/routes/stream.tsx (1)
62-74: Switch<Await>to JSX children to satisfy BiomeBiome still errors on passing the render fn via the
childrenprop (noChildrenProp), so this will fail CI until converted to JSX children.- <Await - promise={promise} - children={(promiseData) => ( + <Await promise={promise}> + {(promiseData) => ( <div className="p-2" data-testid="promise-data"> {promiseData} <div data-testid="stream-data"> {streamData.map((d) => ( <div key={d}>{d}</div> ))} </div> </div> - )} - /> + )} + </Await>e2e/react-start/basic-spa/src/routes/__root.tsx (1)
51-51: Drop unsupportedcolorattribute from the manifest linkrel="manifest"links don’t honor acolorattribute, so this value is ignored. Let’s remove it to keep the head clean.- { rel: 'manifest', href: '/site.webmanifest', color: '#ffffff' }, + { rel: 'manifest', href: '/site.webmanifest' },@@ -0,0 +162,21 @@162+ activeProps={{163+ className: 'font-bold',164+ }}165+ >166+ redirect167+ </Link>{' '}168+ <Link169+ // @ts-expect-error170+ to="/this-route-does-not-exist"171+ activeProps={{172+ className: 'font-bold',173+ }}174+ >175+ This Route Does Not Exist176+ </Link>177+ </div>178+ <hr />179+ {children}180+ <div className="inline-div">This is an inline styled div</div>181+ <RouterDevtools position="bottom-right" />182+ <Scripts />⚠️ Potential issue | 🔴 Critical
Wrap
RouterDevtoolsinSuspenseto avoid runtime crashIn development, this lazy component suspends without a surrounding
Suspense, causing React to throw “A component suspended while rendering, but no fallback UI was specified.” Wrap the render in a suspense boundary.- <RouterDevtools position="bottom-right" /> + <React.Suspense fallback={null}> + <RouterDevtools position="bottom-right" /> + </React.Suspense>📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<hr /> {children} <div className="inline-div">This is an inline styled div</div> <React.Suspense fallback={null}> <RouterDevtools position="bottom-right" /> </React.Suspense> <Scripts />🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/__root.tsx around lines 175 to 182, RouterDevtools is a lazy/suspending component rendered without a Suspense boundary which causes a runtime crash; wrap <RouterDevtools position="bottom-right" /> in a React.Suspense boundary with an appropriate fallback (e.g., null or a small loader) so it can suspend safely, and add/import Suspense from 'react' at the top of the file if not already imported.Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 83404a4f1ee82755ee829eb9c8c4c5cd5c0f7b7f and 23c053c0dcfab0fe653767ffaec701dda59504c4.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
e2e/react-start/basic-spa/tests/redirect.spec.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/react-start/basic-spa/tests/redirect.spec.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/react-start/basic-spa/tests/redirect.spec.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx:3-5 Timestamp: 2025-09-22T00:56:49.237Z Learning: In TanStack Router, underscores are intentionally stripped from route segments (e.g., `$baz_` becomes `baz` in generated types) but should be preserved in base path segments. This is the correct behavior as of the fix in PR #5182.Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts:167-172 Timestamp: 2025-09-22T00:56:53.426Z Learning: In TanStack Router, underscores are intentionally stripped from route segments during path parsing, but preserved in base path segments. This is the expected behavior implemented in PR #5182.⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test
- GitHub Check: Preview
@@ -0,0 +1,13 @@1+import queryString from 'node:querystring'2+import { expect } from '@playwright/test'3+import combinateImport from 'combinate'4+import {5+ getDummyServerPort,6+ getTestServerPort,7+ test,8+} from '@tanstack/router-e2e-utils'9+import packageJson from '../package.json' with { type: 'json' }10+11+// somehow playwright does not correctly import default exports12+const combinate = (combinateImport as any).default as typeof combinateImport13+⚠️ Potential issue | 🟠 Major
Guard the combinate import against both ESM and CJS shapes
Right now we unconditionally read
combinateImport.default. When the runtime actually returns the callable default export (which is the case under native ESM/tsx loaders),.defaultisundefined, socombinatebecomesundefinedand the whole suite crashes on the first matrix generation. Please fall back to the original import when.defaultis absent so the tests keep working regardless of how the module loader surfaces the default export.-const combinate = (combinateImport as any).default as typeof combinateImport +const combinate = ( + (combinateImport as any).default ?? combinateImport +) as typeof combinateImport🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/tests/redirect.spec.ts around lines 11 to 13, the test currently always reads combinateImport.default which breaks when the module loader returns the callable directly; update the assignment to handle both ESM and CJS shapes by checking whether combinateImport.default is defined and falling back to combinateImport when it is not, preserving the existing typing (cast as any if needed) so combinate is the callable in either case.Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 23c053c0dcfab0fe653767ffaec701dda59504c4 and e32791632720f764953898f377259366bd373157.
📒 Files selected for processing (5)
e2e/react-start/basic-spa/package.json(1 hunks)e2e/react-start/basic-spa/playwright.config.ts(1 hunks)e2e/react-start/basic-spa/src/routes/posts.$postId.tsx(1 hunks)e2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsx(1 hunks)e2e/react-start/basic-spa/tests/navigation.spec.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- e2e/react-start/basic-spa/package.json
- e2e/react-start/basic-spa/src/routes/posts.$postId.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/react-start/basic-spa/playwright.config.tse2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsxe2e/react-start/basic-spa/tests/navigation.spec.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/react-start/basic-spa/playwright.config.tse2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsxe2e/react-start/basic-spa/tests/navigation.spec.ts
**/src/routes/**
📄 CodeRabbit inference engine (AGENTS.md)
Place file-based routes under src/routes/ directories
Files:
e2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsx
🧠 Learnings (1)
📓 Common learnings
Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx:3-5 Timestamp: 2025-09-22T00:56:49.237Z Learning: In TanStack Router, underscores are intentionally stripped from route segments (e.g., `$baz_` becomes `baz` in generated types) but should be preserved in base path segments. This is the correct behavior as of the fix in PR #5182.Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts:167-172 Timestamp: 2025-09-22T00:56:53.426Z Learning: In TanStack Router, underscores are intentionally stripped from route segments during path parsing, but preserved in base path segments. This is the expected behavior implemented in PR #5182.🧬 Code graph analysis (2)
e2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsx (2)
e2e/react-start/basic-spa/src/routes/posts.$postId.tsx (1)
Route(7-14)
e2e/react-start/basic-spa/src/utils/posts.tsx (1)
fetchPost(17-33)
e2e/react-start/basic-spa/tests/navigation.spec.ts (1)
e2e/e2e-utils/src/index.ts (1)
test(7-7)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test
- GitHub Check: Preview
🔇 Additional comments (1)
e2e/react-start/basic-spa/tests/navigation.spec.ts (1)
65-68: Stop basing script expectations onprocess.env.NODE_ENV.process.env.NODE_ENVreflects the Playwright runner, not the built app mode, so these assertions misfire (e.g. a prod build exercised under a dev runner). Detect the actual script presence instead and derive the expectation from that, e.g.:- expect(await page.evaluate('window.SCRIPT_2')).toBe( - process.env.NODE_ENV === 'development' ? true : undefined, - ) + const hasScript2 = await page.evaluate( + () => !!document.querySelector('script[src*="script2.js"]'), + ) + expect(await page.evaluate('window.SCRIPT_2')).toBe( + hasScript2 ? true : undefined, + )Apply the same change in the direct navigation test below so both cases read the DOM rather than the runner environment.
Also applies to: 75-77
@@ -0,0 +13,21 @@13+ */14+export default defineConfig({15+ testDir: './tests',16+ workers: 1,17+18+ reporter: [['line']],19+20+ globalSetup: './tests/setup/global.setup.ts',21+ globalTeardown: './tests/setup/global.teardown.ts',22+23+ use: {24+ /* Base URL to use in actions like `await page.goto('/')`. */25+ baseURL,26+ },27+28+ webServer: {29+ command: `NODE_ENV=development VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm run dev:e2e --port=${PORT}`,30+ url: baseURL,31+ reuseExistingServer: !process.env.CI,32+ stdout: 'pipe',33+ },⚠️ Potential issue | 🟠 Major
Fix cross-platform env injection for the dev server command
Prefixing the command with
NODE_ENV=...only works on POSIX shells; on Windows the server will never start, so the whole e2e suite fails. Move these variables into Playwright’senvoption (or usecross-env) so the config runs on every platform.Apply this diff to set the environment variables portably:
webServer: { - command: `NODE_ENV=development VITE_EXTERNAL_PORT=${EXTERNAL_PORT} VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm run dev:e2e --port=${PORT}`, + command: `pnpm run dev:e2e --port=${PORT}`, url: baseURL, reuseExistingServer: !process.env.CI, stdout: 'pipe', + env: { + NODE_ENV: 'development', + VITE_EXTERNAL_PORT: String(EXTERNAL_PORT), + VITE_SERVER_PORT: String(PORT), + PORT: String(PORT), + }, },🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/playwright.config.ts around lines 29 to 33, the dev server command currently prefixes environment variables (e.g. NODE_ENV=...) which fails on Windows; remove those inline env assignments from the command and instead add a Playwright devServer env object (or use cross-env) that sets NODE_ENV='development', VITE_EXTERNAL_PORT=EXTERNAL_PORT, VITE_SERVER_PORT=PORT and PORT=PORT, and change the command to just run pnpm run dev:e2e --port=${PORT} so the server starts cross-platform.✅ Addressed in commit 56aad43
@@ -0,0 +4,21 @@4+5+export const Route = createFileRoute('/posts_/$postId/deep')({6+ loader: async ({ params: { postId } }) => fetchPost({ data: postId }),7+ errorComponent: PostDeepErrorComponent,8+ component: PostDeepComponent,9+})10+11+function PostDeepErrorComponent({ error }: ErrorComponentProps) {12+ return <ErrorComponent error={error} />13+}14+15+function PostDeepComponent() {16+ const post = Route.useLoaderData()17+18+ return (19+ <div className="p-2 space-y-2">20+ <Link21+ to="/posts"22+ className="block py-1 text-blue-800 hover:text-blue-600"23+ >24+ ← All Posts⚠️ Potential issue | 🟠 Major
Fix navigation target for underscored posts route
This file’s static segment is
posts_, so the generated path is/posts_. Linking to/postsdrops the underscore and routes to a different hierarchy. Please point the link at/posts_so the “All Posts” breadcrumb returns to the correct list page.- to="/posts" + to="/posts_"Based on learnings
📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
to="/posts_" className="block py-1 text-blue-800 hover:text-blue-600" > ← All Posts🤖 Prompt for AI Agents
In e2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsx around lines 21 to 24, the "All Posts" link currently points to "/posts" which drops the underscore and navigates to the wrong route; update the link target to "/posts_" (or use the app's route helper for the posts_ index) so the breadcrumb returns to the correct posts_ list page.this is intended
nlynzaad(GitHub profile, opens in a new tab)replied on
e2e/react-start/basic-spa/src/routes/posts_.$postId.deep.tsxlines 21 to 24this is intended
SeanCassiere reviewed
@@ -276,4 +276,4 @@276276 ...split.map((part): Segment => {277277 // strip tailing underscore for non-nested paths278278 const partToMatch =279- !basePathValues && part.slice(-1) === '_' ? part.slice(0, -1) : part279+ !basePathValues && part !== '__root__' && part.slice(-1) === '_'This id is available as a constant in
router-core/src/root.ts, namedrootRouteId.Thanks that cleans up one irk I had.
Thanks that cleans up one irk I had.
SeanCassiere reviewed
e2e/react-start/basic/playwright.config.ts line 12@@ -3,8 +3,10 @@33 getDummyServerPort,44 getTestServerPort,55 } from '@tanstack/router-e2e-utils'6+import { isSpaMode } from 'tests/utils/isSpaMode'67 import packageJson from './package.json' with { type: 'json' }7889 const PORT = await getTestServerPort(packageJson.name)910 const EXTERNAL_PORT = await getDummyServerPort(packageJson.name)1011 const baseURL = `http://localhost:${PORT}`12+const spaModeCommand = `pnpm build && pnpm dev:e2e --port=${PORT}`Testing using dev for spa mode?
If this is a limitation of the single playwright entry, then maybe we can just have a spa mode specific entry like we have in the scroll restoration sandbox.
using dev for spa only to ensure we are mounting in the shell and running the server. not entirely sure yet how to mount the shell and server.ts correctly for production in the test.
you would need to serve the shell (and the other static files) via a custom http server and proxy through the requests for server functions etc to the actual start backend.
If this is a limitation of the single playwright entry, then maybe we can just have a spa mode specific entry like we have in the scroll restoration sandbox.
Actionable comments posted: 2
🧹 Nitpick comments (8)
e2e/react-start/basic/src/routes/users.tsx (1)
6-16: Prefer async/await over mixed .then/.catch in loaderSimplifies flow and preserves stack traces.
Apply:
export const Route = createFileRoute('/users')({ loader: async () => { - return await axios - .get<Array<User>>('/api/users') - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch users') - }) + try { + const { data } = await axios.get<Array<User>>('/api/users') + return data + } catch { + throw new Error('Failed to fetch users') + } }, component: UsersComponent, })e2e/react-start/basic/tests/redirect.spec.ts (6)
9-9: Use simpler relative import for isSpaModeAvoids brittle ../tests/ hopping.
Apply:
-import { isSpaMode } from '../tests/utils/isSpaMode' +import { isSpaMode } from './utils/isSpaMode'
39-60: Use page.waitForRequest instead of manual event/promise raceSimpler, less error-prone, no lingering listeners.
Apply:
- await page.waitForLoadState('networkidle') - let requestHappened = false - - const requestPromise = new Promise<void>((resolve) => { - page.on('request', (request) => { - if ( - request.url().startsWith(`http://localhost:${PORT}/_serverFn/`) - ) { - requestHappened = true - resolve() - } - }) - }) - await link.focus() - - const expectRequestHappened = preload && !reloadDocument - const timeoutPromise = new Promise((resolve) => - setTimeout(resolve, expectRequestHappened ? 5000 : 500), - ) - await Promise.race([requestPromise, timeoutPromise]) - expect(requestHappened).toBe(expectRequestHappened) + await page.waitForLoadState('networkidle') + await link.focus() + const expectRequestHappened = preload && !reloadDocument + const req = await page + .waitForRequest( + (r) => + r.url().startsWith(`http://localhost:${PORT}/_serverFn/`), + { timeout: expectRequestHappened ? 5000 : 500 }, + ) + .catch(() => null) + expect(!!req).toBe(expectRequestHappened)
61-63: Use page.once for domcontentloaded flagPrevents multiple triggers toggling state unexpectedly.
Apply:
- page.on('domcontentloaded', () => { + page.once('domcontentloaded', () => { fullPageLoad = true })
83-90: Set whitelistErrors once per describe instead of inside the loopReduces repetition and makes scope explicit.
Apply within the 'internal' describe, before building the matrix:
// Place near Line 19, before internalNavigationTestMatrix if (isSpaMode) { test.use({ whitelistErrors: [ /A tree hydrated but some attributes of the server rendered HTML/, ], }) }Then remove the per-iteration block:
- if (isSpaMode) { - test.use({ - whitelistErrors: [ - /A tree hydrated but some attributes of the server rendered HTML/, - ], - }) - }
164-166: Use page.once for domcontentloaded in serverFn matrixSame rationale: avoid accumulating listeners.
Apply:
- page.on('domcontentloaded', () => { + page.once('domcontentloaded', () => { fullPageLoad = true })
216-219: Use page.once for domcontentloaded in useServerFn suiteConsistent listener semantics across tests.
Apply:
- page.on('domcontentloaded', () => { + page.once('domcontentloaded', () => { fullPageLoad = true })e2e/react-start/basic/vite.config.ts (1)
24-27: Refresh the @ts-ignore rationaleThe ignore comment still talks about
verboseFileRoutes, but we’re now suppressing the type check for thespaoption. Updating the comment to match the new reason would prevent future confusion.Here’s an updated comment that matches the current code:
- // @ts-ignore we want to keep one test with verboseFileRoutes off even though the option is hidden + // @ts-ignore: the SPA option isn’t exposed in the plugin’s public types yet📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 56aad43c8bf7ef1c7ad3c87f88c5c23c06edc549 and 373681f6c5df88fd089c5ccf172cf2cf2b62a917.
📒 Files selected for processing (49)
e2e/react-start/basic/package.json(1 hunks)e2e/react-start/basic/playwright.config.ts(2 hunks)e2e/react-start/basic/src/routeTree.gen.ts(1 hunks)e2e/react-start/basic/src/routes/__root.tsx(1 hunks)e2e/react-start/basic/src/routes/_layout.tsx(1 hunks)e2e/react-start/basic/src/routes/_layout/_layout-2.tsx(1 hunks)e2e/react-start/basic/src/routes/_layout/_layout-2/layout-a.tsx(1 hunks)e2e/react-start/basic/src/routes/_layout/_layout-2/layout-b.tsx(1 hunks)e2e/react-start/basic/src/routes/api.users.ts(2 hunks)e2e/react-start/basic/src/routes/api/users.$id.ts(2 hunks)e2e/react-start/basic/src/routes/deferred.tsx(2 hunks)e2e/react-start/basic/src/routes/foo/$bar/$qux/_here.tsx(1 hunks)e2e/react-start/basic/src/routes/foo/$bar/$qux/_here/index.tsx(1 hunks)e2e/react-start/basic/src/routes/index.tsx(1 hunks)e2e/react-start/basic/src/routes/inline-scripts.tsx(1 hunks)e2e/react-start/basic/src/routes/links.tsx(1 hunks)e2e/react-start/basic/src/routes/not-found/index.tsx(1 hunks)e2e/react-start/basic/src/routes/not-found/route.tsx(1 hunks)e2e/react-start/basic/src/routes/not-found/via-beforeLoad.tsx(1 hunks)e2e/react-start/basic/src/routes/not-found/via-loader.tsx(1 hunks)e2e/react-start/basic/src/routes/posts.$postId.tsx(2 hunks)e2e/react-start/basic/src/routes/posts.index.tsx(1 hunks)e2e/react-start/basic/src/routes/posts.tsx(1 hunks)e2e/react-start/basic/src/routes/posts_.$postId.deep.tsx(1 hunks)e2e/react-start/basic/src/routes/redirect/$target.tsx(1 hunks)e2e/react-start/basic/src/routes/redirect/$target/index.tsx(1 hunks)e2e/react-start/basic/src/routes/redirect/$target/serverFn/index.tsx(1 hunks)e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx(1 hunks)e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsx(1 hunks)e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx(1 hunks)e2e/react-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx(1 hunks)e2e/react-start/basic/src/routes/redirect/$target/via-loader.tsx(1 hunks)e2e/react-start/basic/src/routes/redirect/index.tsx(1 hunks)e2e/react-start/basic/src/routes/scripts.tsx(1 hunks)e2e/react-start/basic/src/routes/search-params/default.tsx(1 hunks)e2e/react-start/basic/src/routes/search-params/index.tsx(1 hunks)e2e/react-start/basic/src/routes/search-params/loader-throws-redirect.tsx(1 hunks)e2e/react-start/basic/src/routes/search-params/route.tsx(1 hunks)e2e/react-start/basic/src/routes/stream.tsx(1 hunks)e2e/react-start/basic/src/routes/users.$userId.tsx(1 hunks)e2e/react-start/basic/src/routes/users.index.tsx(1 hunks)e2e/react-start/basic/src/routes/users.tsx(1 hunks)e2e/react-start/basic/src/routes/대한민국.tsx(1 hunks)e2e/react-start/basic/tests/navigation.spec.ts(2 hunks)e2e/react-start/basic/tests/redirect.spec.ts(2 hunks)e2e/react-start/basic/tests/search-params.spec.ts(2 hunks)e2e/react-start/basic/tests/utils/isSpaMode.ts(1 hunks)e2e/react-start/basic/vite.config.ts(2 hunks)packages/router-core/src/path.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/router-core/src/path.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/react-start/basic/tests/utils/isSpaMode.tse2e/react-start/basic/tests/navigation.spec.tse2e/react-start/basic/tests/search-params.spec.tse2e/react-start/basic/src/routes/users.tsxe2e/react-start/basic/src/routes/redirect/index.tsxe2e/react-start/basic/src/routes/_layout/_layout-2.tsxe2e/react-start/basic/src/routes/index.tsxe2e/react-start/basic/src/routes/_layout/_layout-2/layout-a.tsxe2e/react-start/basic/src/routes/search-params/route.tsxe2e/react-start/basic/src/routes/search-params/index.tsxe2e/react-start/basic/src/routes/api.users.tse2e/react-start/basic/src/routes/posts.index.tsxe2e/react-start/basic/src/routes/scripts.tsxe2e/react-start/basic/src/routes/api/users.$id.tse2e/react-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsxe2e/react-start/basic/src/routes/posts_.$postId.deep.tsxe2e/react-start/basic/src/routes/_layout.tsxe2e/react-start/basic/src/routes/__root.tsxe2e/react-start/basic/src/routes/redirect/$target/index.tsxe2e/react-start/basic/playwright.config.tse2e/react-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsxe2e/react-start/basic/src/routes/대한민국.tsxe2e/react-start/basic/src/routes/_layout/_layout-2/layout-b.tsxe2e/react-start/basic/src/routes/not-found/index.tsxe2e/react-start/basic/vite.config.tse2e/react-start/basic/src/routes/links.tsxe2e/react-start/basic/tests/redirect.spec.tse2e/react-start/basic/src/routes/foo/$bar/$qux/_here/index.tsxe2e/react-start/basic/src/routes/redirect/$target.tsxe2e/react-start/basic/src/routes/inline-scripts.tsxe2e/react-start/basic/src/routes/foo/$bar/$qux/_here.tsxe2e/react-start/basic/src/routes/not-found/via-beforeLoad.tsxe2e/react-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsxe2e/react-start/basic/src/routes/redirect/$target/via-beforeLoad.tsxe2e/react-start/basic/src/routes/redirect/$target/serverFn/index.tsxe2e/react-start/basic/src/routes/search-params/default.tsxe2e/react-start/basic/src/routes/stream.tsxe2e/react-start/basic/src/routes/deferred.tsxe2e/react-start/basic/src/routes/not-found/route.tsxe2e/react-start/basic/src/routes/not-found/via-loader.tsxe2e/react-start/basic/src/routes/users.$userId.tsxe2e/react-start/basic/src/routes/posts.$postId.tsxe2e/react-start/basic/src/routes/redirect/$target/via-loader.tsxe2e/react-start/basic/src/routes/users.index.tsxe2e/react-start/basic/src/routes/search-params/loader-throws-redirect.tsxe2e/react-start/basic/src/routes/posts.tsxe2e/react-start/basic/src/routeTree.gen.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/react-start/basic/tests/utils/isSpaMode.tse2e/react-start/basic/package.jsone2e/react-start/basic/tests/navigation.spec.tse2e/react-start/basic/tests/search-params.spec.tse2e/react-start/basic/src/routes/users.tsxe2e/react-start/basic/src/routes/redirect/index.tsxe2e/react-start/basic/src/routes/_layout/_layout-2.tsxe2e/react-start/basic/src/routes/index.tsxe2e/react-start/basic/src/routes/_layout/_layout-2/layout-a.tsxe2e/react-start/basic/src/routes/search-params/route.tsxe2e/react-start/basic/src/routes/search-params/index.tsxe2e/react-start/basic/src/routes/api.users.tse2e/react-start/basic/src/routes/posts.index.tsxe2e/react-start/basic/src/routes/scripts.tsxe2e/react-start/basic/src/routes/api/users.$id.tse2e/react-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsxe2e/react-start/basic/src/routes/posts_.$postId.deep.tsxe2e/react-start/basic/src/routes/_layout.tsxe2e/react-start/basic/src/routes/__root.tsxe2e/react-start/basic/src/routes/redirect/$target/index.tsxe2e/react-start/basic/playwright.config.tse2e/react-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsxe2e/react-start/basic/src/routes/대한민국.tsxe2e/react-start/basic/src/routes/_layout/_layout-2/layout-b.tsxe2e/react-start/basic/src/routes/not-found/index.tsxe2e/react-start/basic/vite.config.tse2e/react-start/basic/src/routes/links.tsxe2e/react-start/basic/tests/redirect.spec.tse2e/react-start/basic/src/routes/foo/$bar/$qux/_here/index.tsxe2e/react-start/basic/src/routes/redirect/$target.tsxe2e/react-start/basic/src/routes/inline-scripts.tsxe2e/react-start/basic/src/routes/foo/$bar/$qux/_here.tsxe2e/react-start/basic/src/routes/not-found/via-beforeLoad.tsxe2e/react-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsxe2e/react-start/basic/src/routes/redirect/$target/via-beforeLoad.tsxe2e/react-start/basic/src/routes/redirect/$target/serverFn/index.tsxe2e/react-start/basic/src/routes/search-params/default.tsxe2e/react-start/basic/src/routes/stream.tsxe2e/react-start/basic/src/routes/deferred.tsxe2e/react-start/basic/src/routes/not-found/route.tsxe2e/react-start/basic/src/routes/not-found/via-loader.tsxe2e/react-start/basic/src/routes/users.$userId.tsxe2e/react-start/basic/src/routes/posts.$postId.tsxe2e/react-start/basic/src/routes/redirect/$target/via-loader.tsxe2e/react-start/basic/src/routes/users.index.tsxe2e/react-start/basic/src/routes/search-params/loader-throws-redirect.tsxe2e/react-start/basic/src/routes/posts.tsxe2e/react-start/basic/src/routeTree.gen.ts
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Use workspace:* protocol for internal dependencies in package.json files
Files:
e2e/react-start/basic/package.json
**/src/routes/**
📄 CodeRabbit inference engine (AGENTS.md)
Place file-based routes under src/routes/ directories
Files:
e2e/react-start/basic/src/routes/users.tsxe2e/react-start/basic/src/routes/redirect/index.tsxe2e/react-start/basic/src/routes/_layout/_layout-2.tsxe2e/react-start/basic/src/routes/index.tsxe2e/react-start/basic/src/routes/_layout/_layout-2/layout-a.tsxe2e/react-start/basic/src/routes/search-params/route.tsxe2e/react-start/basic/src/routes/search-params/index.tsxe2e/react-start/basic/src/routes/api.users.tse2e/react-start/basic/src/routes/posts.index.tsxe2e/react-start/basic/src/routes/scripts.tsxe2e/react-start/basic/src/routes/api/users.$id.tse2e/react-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsxe2e/react-start/basic/src/routes/posts_.$postId.deep.tsxe2e/react-start/basic/src/routes/_layout.tsxe2e/react-start/basic/src/routes/__root.tsxe2e/react-start/basic/src/routes/redirect/$target/index.tsxe2e/react-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsxe2e/react-start/basic/src/routes/대한민국.tsxe2e/react-start/basic/src/routes/_layout/_layout-2/layout-b.tsxe2e/react-start/basic/src/routes/not-found/index.tsxe2e/react-start/basic/src/routes/links.tsxe2e/react-start/basic/src/routes/foo/$bar/$qux/_here/index.tsxe2e/react-start/basic/src/routes/redirect/$target.tsxe2e/react-start/basic/src/routes/inline-scripts.tsxe2e/react-start/basic/src/routes/foo/$bar/$qux/_here.tsxe2e/react-start/basic/src/routes/not-found/via-beforeLoad.tsxe2e/react-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsxe2e/react-start/basic/src/routes/redirect/$target/via-beforeLoad.tsxe2e/react-start/basic/src/routes/redirect/$target/serverFn/index.tsxe2e/react-start/basic/src/routes/search-params/default.tsxe2e/react-start/basic/src/routes/stream.tsxe2e/react-start/basic/src/routes/deferred.tsxe2e/react-start/basic/src/routes/not-found/route.tsxe2e/react-start/basic/src/routes/not-found/via-loader.tsxe2e/react-start/basic/src/routes/users.$userId.tsxe2e/react-start/basic/src/routes/posts.$postId.tsxe2e/react-start/basic/src/routes/redirect/$target/via-loader.tsxe2e/react-start/basic/src/routes/users.index.tsxe2e/react-start/basic/src/routes/search-params/loader-throws-redirect.tsxe2e/react-start/basic/src/routes/posts.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx:3-5 Timestamp: 2025-09-22T00:56:49.237Z Learning: In TanStack Router, underscores are intentionally stripped from route segments (e.g., `$baz_` becomes `baz` in generated types) but should be preserved in base path segments. This is the correct behavior as of the fix in PR #5182.Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts:167-172 Timestamp: 2025-09-22T00:56:53.426Z Learning: In TanStack Router, underscores are intentionally stripped from route segments during path parsing, but preserved in base path segments. This is the expected behavior implemented in PR #5182.📚 Learning: 2025-09-23T17:36:12.598Z
Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/Applied to files:
e2e/react-start/basic/src/routes/__root.tsxe2e/react-start/basic/src/routes/foo/$bar/$qux/_here/index.tsx
🧬 Code graph analysis (17)
e2e/react-start/basic/tests/navigation.spec.ts (1)
e2e/react-start/basic/tests/utils/isSpaMode.ts (1)
isSpaMode(1-1)
e2e/react-start/basic/tests/search-params.spec.ts (1)
e2e/react-start/basic/tests/utils/isSpaMode.ts (1)
isSpaMode(1-1)
e2e/react-start/basic/src/routes/search-params/route.tsx (2)
e2e/react-start/basic/src/routes/search-params/default.tsx (1)
Route(4-28)
e2e/react-start/basic/src/routes/search-params/index.tsx (1)
Route(3-5)
e2e/react-start/basic/src/routes/search-params/index.tsx (3)
e2e/react-router/basic-file-based/src/routes/search-params/index.tsx (1)
Route(3-5)
e2e/solid-router/basic-file-based/src/routes/search-params/index.tsx (1)
Route(3-5)
e2e/solid-start/basic/src/routes/search-params/index.tsx (1)
Route(3-5)
e2e/react-start/basic/src/routes/api.users.ts (1)
e2e/react-start/basic/src/routes/api/users.$id.ts (1)
Route(12-32)
e2e/react-start/basic/src/routes/scripts.tsx (1)
e2e/solid-start/basic/src/routes/scripts.tsx (1)
Route(5-19)
e2e/react-start/basic/src/routes/api/users.$id.ts (1)
e2e/react-start/basic/src/routes/api.users.ts (1)
Route(13-28)
e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx (1)
e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx (1)
Route(4-12)
e2e/react-start/basic/playwright.config.ts (2)
e2e/e2e-utils/src/derivePort.ts (2)
getTestServerPort(25-27)getDummyServerPort(21-23)
e2e/react-start/basic/tests/utils/isSpaMode.ts (1)
isSpaMode(1-1)
e2e/react-start/basic/vite.config.ts (1)
e2e/react-start/basic/tests/utils/isSpaMode.ts (1)
isSpaMode(1-1)
e2e/react-start/basic/tests/redirect.spec.ts (1)
e2e/react-start/basic/tests/utils/isSpaMode.ts (1)
isSpaMode(1-1)
e2e/react-start/basic/src/routes/inline-scripts.tsx (2)
e2e/react-start/basic/src/routes/__root.tsx (1)
Route(16-75)
e2e/solid-start/basic/src/routes/inline-scripts.tsx (1)
Route(3-18)
e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx (1)
e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx (1)
Route(4-18)
e2e/react-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx (3)
e2e/react-start/basic/src/routes/redirect/$target/via-loader.tsx (1)
Route(3-17)
e2e/solid-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx (1)
Route(3-16)
e2e/solid-start/basic/src/routes/redirect/$target/via-loader.tsx (1)
Route(3-17)
e2e/react-start/basic/src/routes/search-params/default.tsx (2)
e2e/react-start/basic/src/routes/search-params/index.tsx (1)
Route(3-5)
e2e/react-router/basic-file-based/src/routes/search-params/default.tsx (1)
Route(4-28)
e2e/react-start/basic/src/routes/redirect/$target/via-loader.tsx (2)
e2e/react-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx (1)
Route(3-16)
e2e/solid-start/basic/src/routes/redirect/$target/via-loader.tsx (1)
Route(3-17)
e2e/react-start/basic/src/routes/search-params/loader-throws-redirect.tsx (2)
e2e/react-start/basic/src/routes/search-params/route.tsx (1)
Route(3-8)
e2e/solid-start/basic/src/routes/search-params/loader-throws-redirect.tsx (1)
Route(4-26)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
🔇 Additional comments (31)
e2e/react-start/basic/src/routes/__root.tsx (1)
181-183: LGTM: Suspense wrapper matches lazy devtools usageWrapping the lazily-loaded
RouterDevtoolsinReact.Suspenseavoids runtime warnings when the lazy import resolves later, while keeping production builds unaffected with the null fallback. Nicely done.e2e/react-start/basic/src/routes/api/users.$id.ts (1)
12-32: Looks goodPath-first invocation and server handler wiring stay intact; no issues spotted.
e2e/react-start/basic/src/routes/posts_.$postId.deep.tsx (1)
5-13: Nice upgradePath binding stays accurate and the dedicated error wrapper keeps the UX consistent.
e2e/react-start/basic/src/routes/users.index.tsx (1)
3-5: Route path literal is correct The generator’s FileRoutesByPath includes/users/(not/users) for the index route, socreateFileRoute('/users/')already matches.e2e/react-start/basic/src/routes/redirect/$target/index.tsx (1)
3-76: Verify trailing slash semantics Ensure the generated route path for/redirect/$target/includes the trailing slash; if it’s emitted as/redirect/$target(no slash),Route.fullPath–based links will misbehave. Inspect your route manifest (e.g.routeTree.gen.ts) in the build output.e2e/react-start/basic/src/routes/대한민국.tsx (1)
3-5: Explicit path keeps the Hangul segment intactSwitching to the path-first
createFileRoute('/대한민국')call locks in the intended Unicode segment so the new root parsing change can’t strip it. Looks solid.e2e/react-start/basic/src/routes/search-params/loader-throws-redirect.tsx (1)
4-26: Path-first binding lines up with the redirect targetExplicitly registering
/search-params/loader-throws-redirectensures the loader’s redirect target stays consistent after the root-id parsing tweak. The rest of the loader/search wiring still behaves as before.e2e/react-start/basic/src/routes/redirect/$target/via-loader.tsx (1)
3-17: Route id now mirrors the loader redirect casesThe added path literal
/redirect/$target/via-loaderkeeps the loader’s internal redirects aligned with the generated route id, so the SPA mode regression is avoided.e2e/react-start/basic/src/routes/posts.index.tsx (1)
3-5: Index route retains its trailing-slash identityLocking the index route to
/posts/preserves the expected trailing-slash semantics for the posts overview after the root-route handling change. Looks correct.e2e/react-start/basic/src/routes/scripts.tsx (1)
5-19: Explicit/scriptsroute id matches head/component wiringThe head metadata and dev/prod script toggles now sit on a stable
/scriptsid, which should keep SPA navigation behaving. Nice.e2e/react-start/basic/src/routes/posts.$postId.tsx (2)
7-14: Path-first route + notFoundComponent look correctSwitch to createFileRoute('/posts/$postId') and adding notFoundComponent aligns with the PR goals and improves UX for missing posts.
16-18: No external imports of PostErrorComponent found Removed export in routes/posts.$postId.tsx doesn’t break any imports.e2e/react-start/basic/src/routes/foo/$bar/$qux/_here.tsx (1)
3-5: Good: path-first route, underscore segment preservedcreateFileRoute('/foo/$bar/$qux/_here') is consistent with preserving underscores in base path segments. Parent layout without trailing slash pairs well with the index child route.
Based on learnings
e2e/react-start/basic/src/routes/foo/$bar/$qux/_here/index.tsx (2)
1-1: LGTMImport of createFileRoute is correct.
3-6: Index route path is consistentUsing a trailing slash in createFileRoute('/foo/$bar/$qux/_here/') correctly denotes the index route under the _here segment.
e2e/react-start/basic/src/routes/users.tsx (1)
1-1: LGTMImport changes are aligned with the path-first route pattern.
e2e/react-start/basic/src/routes/links.tsx (1)
3-47: Path-first route binding looks solidBinding
createFileRoutewith/linkskeeps the file path and route id aligned with the updated parsing logic, andRoute.useNavigatestill resolves correctly. Nice job.e2e/react-start/basic/src/routes/inline-scripts.tsx (1)
3-18: Inline-scripts route update aligns with the new APISupplying the explicit
/inline-scriptspath keeps this route consistent with the other SPA-mode fixtures and avoids ambiguity in the generated route ids. Looks good.e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsx (1)
4-12: Dynamic redirect route remains intactPassing the explicit
/redirect/$target/serverFn/via-loaderpath preserves the dynamic segment while keeping the loader logic unchanged. This should exercise the trailing-underscore parsing fix as intended.e2e/react-start/basic/src/routes/not-found/via-beforeLoad.tsx (1)
3-15: Not-found guard stays effectiveThe explicit
/not-found/via-beforeLoadpath keeps this route’s notFound guard wired up while matching the updated path parser expectations. All good.e2e/react-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx (1)
4-6: Path-first route binding looks correctThe bound path matches the file-system location and preserves the existing route behavior. Nice cleanup.
e2e/react-start/basic/src/routes/redirect/$target.tsx (1)
4-21: Dynamic segment routing stays intactUsing
createFileRoute('/redirect/$target')keeps the param parsing and search middleware wired exactly as before while aligning with the new API shape.e2e/react-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx (1)
3-16: SPA redirect flow remains consistentThe path string mirrors the file-based segment, so the beforeLoad redirect logic continues to fire for both internal and external targets.
e2e/react-start/basic/src/routes/_layout/_layout-2/layout-a.tsx (1)
3-5: Layout route registration looks goodBinding
/_layout/_layout-2/layout-aup front matches the generated layout structure without altering the component output.e2e/react-start/basic/src/routes/search-params/index.tsx (1)
3-5: Index route path stays canonicalThe trailing-slash path keeps the index route discoverable and consistent with other platform examples.
e2e/react-start/basic/src/routes/_layout/_layout-2/layout-b.tsx (1)
1-5: Path binding matches the layout hierarchyProviding the explicit
/_layout/_layout-2/layout-bpath keeps this layout’s route id aligned with the file-system hierarchy while still letting the new root-id logic handle underscore stripping correctly. Looks solid.e2e/react-start/basic/src/routes/search-params/route.tsx (1)
1-8: SPA context route wired correctlyThe switch to
createFileRoute('/search-params')keeps the parent context loader intact and ensures the root-id logic can honor the segment. All good here.e2e/react-start/basic/src/routes/redirect/$target/serverFn/index.tsx (1)
1-86: Dynamic serverFn route path looks correctThe path-first invocation preserves the
$targetparameter and trailing slash for the index route, so the generated links will continue to resolve as expected.e2e/react-start/basic/src/routes/not-found/via-loader.tsx (1)
1-15: Not-found loader route alignedExplicitly binding
/not-found/via-loaderkeeps the loader +notFoundpairing working with the updated parser. No issues spotted.e2e/react-start/basic/src/routes/search-params/default.tsx (1)
4-28: Default search params route remains consistentThe new path binding mirrors the folder structure and keeps validation/loader logic untouched. Implementation looks good.
e2e/react-start/basic/src/routeTree.gen.ts (1)
550-555:/linkspreLoaderRoute now points at the right moduleGood catch—wiring
/linkstoLinksRouteImportkeeps the generated typings aligned with the actual route definition and avoids the inline-scripts mismatch. Looks solid.Resolvedby nlynzaad(GitHub profile, opens in a new tab)@@ -3,8 +3,11 @@33 getDummyServerPort,44 getTestServerPort,55 } from '@tanstack/router-e2e-utils'6+import { isSpaMode } from 'tests/utils/isSpaMode'67 import packageJson from './package.json' with { type: 'json' }7889 const PORT = await getTestServerPort(packageJson.name)910 const EXTERNAL_PORT = await getDummyServerPort(packageJson.name)1011 const baseURL = `http://localhost:${PORT}`12+const spaModeCommand = `pnpm build && pnpm dev:e2e --port=${PORT}`13+const ssrModeCommand = `pnpm build && pnpm start`⚠️ Potential issue | 🔴 Critical
Fix SPA server command argument forwarding
pnpm dev:e2e --port=…makes pnpm treat--portas its own flag and it exits with “Unknown option '--port'”, so the SPA web server never starts and the Playwright run fails. Forward the flag to the underlying Vite command with--.-const spaModeCommand = `pnpm build && pnpm dev:e2e --port=${PORT}` +const spaModeCommand = `pnpm build && pnpm dev:e2e -- --port=${PORT}`📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const spaModeCommand = `pnpm build && pnpm dev:e2e -- --port=${PORT}` const ssrModeCommand = `pnpm build && pnpm start`🤖 Prompt for AI Agents
In e2e/react-start/basic/playwright.config.ts around lines 12-13, the SPA server command uses `pnpm dev:e2e --port=...` which pnpm interprets as its own flag; change the command to forward the flag to the underlying script by inserting `--` before the port flag (i.e., use `pnpm dev:e2e -- --port=...`), leaving the ssr command unchanged.this is wrong
Resolvedby nlynzaad(GitHub profile, opens in a new tab)@@ -1,5 +1,5 @@1-import { Outlet } from '@tanstack/react-router'1+import { Outlet, createFileRoute } from '@tanstack/react-router'223-export const Route = createFileRoute({3+export const Route = createFileRoute('/_layout')({44 component: LayoutComponent,55 })⚠️ Potential issue | 🟠 Major
Root layout path needs verification
The root layout file previously relied on the generator to supply the correct path (usually the pathless
__root__layout). Hard-codingcreateFileRoute('/_layout')might register an actual/vs/ _layoutmismatch. Please confirm the generator still maps this layout to the expected root id/path; adjust if it should stay pathless (often__root__).In many setups this needs to be:
-export const Route = createFileRoute('/_layout')({ +export const Route = createFileRoute('__root__')({(or the appropriate pathless identifier). Let’s assert against the generated route tree to be certain.
📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export const Route = createFileRoute('__root__')({ component: LayoutComponent, })this is wrong
nlynzaad(GitHub profile, opens in a new tab)replied on
e2e/react-start/basic/src/routes/_layout.tsxlines 3 to 5this is wrong
nlynzaad(GitHub profile, opens in a new tab)replied on
e2e/react-start/basic/playwright.config.tslines 12 to 13this is wrong
nlynzaad(GitHub profile, opens in a new tab)replied on
e2e/react-start/basic/playwright.config.tsline 12using dev for spa only to ensure we are mounting in the shell and running the server. not entirely sure yet how to mount the shell and server.ts correctly for production in the test.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 373681f6c5df88fd089c5ccf172cf2cf2b62a917 and ebb988716fa85eed5e85f21d73baad6994c18966.
📒 Files selected for processing (4)
e2e/solid-start/basic/package.json(1 hunks)e2e/solid-start/basic/playwright.config.ts(2 hunks)e2e/solid-start/basic/tests/navigation.spec.ts(2 hunks)e2e/solid-start/basic/tests/utils/isSpaMode.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
e2e/solid-start/basic/tests/utils/isSpaMode.tse2e/solid-start/basic/playwright.config.tse2e/solid-start/basic/tests/navigation.spec.ts
e2e/**
📄 CodeRabbit inference engine (AGENTS.md)
Store end-to-end tests under the e2e/ directory
Files:
e2e/solid-start/basic/tests/utils/isSpaMode.tse2e/solid-start/basic/playwright.config.tse2e/solid-start/basic/tests/navigation.spec.tse2e/solid-start/basic/package.json
**/package.json
📄 CodeRabbit inference engine (AGENTS.md)
Use workspace:* protocol for internal dependencies in package.json files
Files:
e2e/solid-start/basic/package.json
🧠 Learnings (1)
📓 Common learnings
Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx:3-5 Timestamp: 2025-09-22T00:56:49.237Z Learning: In TanStack Router, underscores are intentionally stripped from route segments (e.g., `$baz_` becomes `baz` in generated types) but should be preserved in base path segments. This is the correct behavior as of the fix in PR #5182.Learnt from: nlynzaad PR: TanStack/router#5182 File: e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts:167-172 Timestamp: 2025-09-22T00:56:53.426Z Learning: In TanStack Router, underscores are intentionally stripped from route segments during path parsing, but preserved in base path segments. This is the expected behavior implemented in PR #5182.Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/router-core/** : Keep framework-agnostic core router logic in packages/router-core/Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{router-cli,router-generator,router-plugin,virtual-file-routes}/** : Keep CLI, generators, bundler plugins, and virtual file routing utilities in their dedicated tooling package directoriesLearnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{react-router,solid-router}/** : Implement React and Solid bindings/components only in packages/react-router/ and packages/solid-router/Learnt from: CR PR: TanStack/router#0 File: AGENTS.md:0-0 Timestamp: 2025-09-23T17:36:12.598Z Learning: Applies to packages/{router-devtools,*-router-devtools}/** : Keep router devtools packages in packages/router-devtools/ and packages/*-router-devtools/🧬 Code graph analysis (2)
e2e/solid-start/basic/playwright.config.ts (2)
e2e/e2e-utils/src/derivePort.ts (2)
getTestServerPort(25-27)getDummyServerPort(21-23)
e2e/solid-start/basic/tests/utils/isSpaMode.ts (1)
isSpaMode(1-1)
e2e/solid-start/basic/tests/navigation.spec.ts (1)
e2e/solid-start/basic/tests/utils/isSpaMode.ts (1)
isSpaMode(1-1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
e2e/solid-start/basic/playwright.config.ts lines 12 to 13@@ -4,7 +4,10 @@44 getTestServerPort,55 } from '@tanstack/router-e2e-utils'66 import packageJson from './package.json' with { type: 'json' }7+import { isSpaMode } from './tests/utils/isSpaMode'7889 const PORT = await getTestServerPort(packageJson.name)910 const EXTERNAL_PORT = await getDummyServerPort(packageJson.name)1011 const baseURL = `http://localhost:${PORT}`12+const spaModeCommand = `pnpm build && pnpm dev:e2e --port=${PORT}`13+const ssrModeCommand = `pnpm build && pnpm start`⚠️ Potential issue | 🔴 Critical
Fix SPA webServer command argument forwarding.
pnpm dev:e2e --port=${PORT}treats--portas a pnpm CLI flag, so pnpm bails out with “Unknown option '--port'” and the Playwright web server never starts in SPA mode. Forward the flag with--(or drop it and rely on the PORT env you already set) so the dev server actually launches.-const spaModeCommand = `pnpm build && pnpm dev:e2e --port=${PORT}` +const spaModeCommand = `pnpm build && pnpm dev:e2e -- --port=${PORT}`🤖 Prompt for AI Agents
In e2e/solid-start/basic/playwright.config.ts around lines 12 to 13, the SPA webServer command forwards --port directly to pnpm which treats it as a pnpm CLI flag and errors; change the SPA command so the port flag is forwarded to the script (either add a double-dash separator before the flag, e.g. use pnpm dev:e2e -- --port=${PORT}, or remove the --port argument entirely and rely on the existing PORT env variable) so the dev server actually starts in SPA mode.schiller-manuel(GitHub profile, opens in a new tab)replied on
e2e/react-start/basic/playwright.config.tsline 12you would need to serve the shell (and the other static files) via a custom http server and proxy through the requests for server functions etc to the actual start backend.
Sign in to join this conversation.
Walkthrough#
Adjusts router-core path parsing to preserve
rootRouteIdunderscores, shifts sample app file-routes to a path-firstcreateFileRoute('/path')({ ... })API, adds SPA vs SSR e2e modes and SPA-aware Playwright wiring/tests, trims generated route typings, and wraps RouterDevtools in Suspense.Changes#
packages/router-core/src/path.tsrootRouteId;baseParsePathnameno longer strips trailing underscores for segments equal torootRouteIdwhenbasePathValuesis false.e2e/*/basic/package.json,e2e/*/basic/playwright.config.ts,e2e/*/basic/tests/utils/isSpaMode.tstest:e2e:spaMode/test:e2e:ssrMode, compositetest:e2e; Playwright selects webServer command byisSpaModeand sets env vars; addisSpaModeutil. (applies to react-start and solid-start e2e folders)e2e/react-start/basic/vite.config.tsspaModeintotanstackStartplugin configuration, enabling prerender/index.html whenMODE=spa.e2e/react-start/basic/src/routeTree.gen.tse2e/react-start/basic/src/routes/__root.tsxRouterDevtoolsinReact.Suspensewith a null fallback.Many files under
e2e/react-start/basic/src/routes/*(e.g.index.tsx,posts*,users*,redirect*,search-params*,scripts.tsx,links.tsx,inline-scripts.tsx,대한민국.tsx, etc.)createFileRoute({ ... })withcreateFileRoute('/<path>')({ ... }); addcreateFileRouteimports; small related tweaks (e.g.,posts.$postIdaddsnotFoundComponent,usersloader maps.data, introducePostDeepErrorComponent).e2e/react-start/basic/tests/*(navigation.spec.ts,redirect.spec.ts,search-params.spec.ts)isSpaMode; update navigation assertions for SCRIPT_2.Sequence Diagram(s)#
Estimated code review effort#
🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related PRs#
packages/router-core/src/path.tsand related trailing-underscore/basePath handling.packages/router-core/src/path.tsand interpolatePath behavior; overlaps with parsing edits.Suggested reviewers#
Poem#
Pre-merge checks and finishing touches#
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Comment `@coderabbitai help` to get the list of available commands and usage tips.