Skip to content

Conversation

@nlynzaad
Copy link
Contributor

@nlynzaad nlynzaad commented Dec 20, 2025

since #5722 landed the usage of the experimental non-nested paths flag is no longer required. The core issue with failed matching was addressed during this rewrite.

This PR removes the now redundant flag.

Summary by CodeRabbit

  • Chores
    • Removed experimental non-nested routes feature and configuration option
    • Simplified E2E testing setup by removing non-nested route test variants
    • Cleaned up documentation by removing non-nested routes guidance
    • Consolidated test scripts to single default test flow
    • Simplified route path generation logic throughout the codebase

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added documentation Everything documentation related package: router-generator labels Dec 20, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 20, 2025

Walkthrough

This PR removes the experimental nonNestedRoutes feature flag throughout the codebase, including documentation, e2e test configurations, route definitions, router-generator utilities, and test snapshots. Route path handling is simplified to use literal, unconditional path segments.

Changes

Cohort / File(s) Summary
Documentation
docs/router/framework/react/routing/file-naming-conventions.md, docs/router/framework/react/routing/routing-concepts.md
Removed notes and documentation blocks about the experimental nonNestedRoutes feature flag, its configuration, and behavior guidance.
E2E React Router Tests
e2e/react-router/basic-file-based/package.json, e2e/react-router/basic-file-based/playwright.config.ts, e2e/react-router/basic-file-based/vite.config.js
Removed nonnested-variant build/test scripts and simplified test runner to use a single, unconditional build-preview command. Removed experimental.nonNestedRoutes config option.
E2E React Router Route Files
e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx, e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
Replaced conditional path logic with literal, fixed paths (e.g., /posts_/$postId/edit). Removed useExperimentalNonNestedRoutes dependency.
E2E React Router Test Utilities & Tests
e2e/react-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts, e2e/react-router/basic-file-based/tests/app.spec.ts
Removed useExperimentalNonNestedRoutes export. Updated navigation test to await completion and synchronize before assertions.
E2E Solid Router Tests
e2e/solid-router/basic-file-based/package.json, e2e/solid-router/basic-file-based/playwright.config.ts, e2e/solid-router/basic-file-based/vite.config.js
Removed nonnested-variant build/test scripts. Simplified test runner to use unconditional build-preview command. Removed experimental.nonNestedRoutes config option.
E2E Solid Router Route Files
e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx, e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
Replaced conditional path logic with literal, fixed paths. Removed useExperimentalNonNestedRoutes dependency.
E2E Solid Router Test Utilities
e2e/solid-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts
Removed useExperimentalNonNestedRoutes export.
Router-Generator Config
packages/router-generator/src/config.ts
Removed nonNestedRoutes option from experimental config schema.
Router-Generator File System
packages/router-generator/src/filesystem/physical/getRouteNodes.ts
Removed experimental flag from config type. Stopped extracting and propagating _isExperimentalNonNestedRoute from route nodes.
Router-Generator Core
packages/router-generator/src/generator.ts
Simplified function calls by removing config parameters. Updated path cleaning to use single unconditional logic. Removed removeLeadingUnderscores usage.
Router-Generator Types & Utilities
packages/router-generator/src/types.ts, packages/router-generator/src/utils.ts
Removed _isExperimentalNonNestedRoute property from RouteNode. Simplified RoutePrefixMap by removing nonNestedRoutes tracking. Updated signatures for determineInitialRoutePath, inferFullPath, inferTo, createRouteNodesByFullPath/To, and hasParentRoute to remove config dependencies. Removed isValidNonNestedRoute and findParentForNonNested helpers.
Router-Generator Tests
packages/router-generator/tests/deny-route-group-config.test.ts, packages/router-generator/tests/generator.test.ts
Removed nonNested parameter from test setup. Unified route tree filenames from nonNested variants to single form. Removed nonNestedRoutes from generated configs.
Router-Generator Test Snapshots
packages/router-generator/tests/generator/*/routeTree.nonnested.snapshot.ts (30+ snapshot files), packages/router-generator/tests/generator/nested-verboseFileRoutes-{false,true}/tests.nonnested.test-d.ts, packages/router-generator/tests/generator/types-disabled/routeTree.nonnested.snapshot.js
Deleted all nonNested variant snapshot and test files. These are auto-generated test fixtures that are no longer needed.
Router-Generator Test Utilities
packages/router-generator/tests/utils.test.ts
Removed isValidNonNestedRoute tests. Updated determineInitialRoutePath tests to reflect removed config parameter and _isExperimentalNonNestedRoute in return type.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Specific areas requiring attention:

  • packages/router-generator/src/utils.ts: Extensive refactoring of signature changes for multiple utility functions; verify all call sites are updated correctly and path inference logic remains sound
  • packages/router-generator/src/generator.ts: Confirm that removal of conditional path cleaning and simplified hasParentRoute usage doesn't introduce edge cases in nested route handling
  • Route-node type shape changes: Verify that removal of _isExperimentalNonNestedRoute from RouteNode doesn't break downstream consumers or type expectations
  • Snapshot file deletions: Confirm these are safe deletions (generated test fixtures) and no other test infrastructure depends on them
  • E2E test synchronization changes: Review the added waitForURL calls to ensure they address actual race conditions without introducing false negatives

Possibly related PRs

  • PR #5402: Directly related; both touch the same nonNestedRoutes feature surface and remove the experimental flag from multiple configuration/utility layers
  • PR #5633: Related; removes experimental nonNestedRoutes option and standardizes route names to underscore variants
  • PR #6121: Related; PR #6121 added non-nested route handling logic that this PR now removes from the codebase

Suggested labels

package: router-generator

Suggested reviewers

  • schiller-manuel

Poem

🐰 The nested route trails fade into mist,
No more underscore conditionals to resist,
One path forward, clean and bright,
Simplicity wins—oh what a sight!
bounces happily

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor(router-generator): remove experimental nonnested paths' accurately and clearly summarizes the primary change—removing the experimental non-nested paths feature.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch removed-experimental-nonnested

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Dec 20, 2025

View your CI Pipeline Execution ↗ for commit 12d9acd

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

☁️ Nx Cloud last updated this comment at 2025-12-20 12:23:59 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 20, 2025

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6154

@tanstack/directive-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@6154

@tanstack/eslint-plugin-router

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

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6154

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6154

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6154

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6154

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@6154

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6154

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6154

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6154

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6154

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6154

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6154

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6154

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6154

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6154

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6154

@tanstack/vue-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6154

@tanstack/vue-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6154

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6154

commit: 12d9acd

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
e2e/solid-router/basic-file-based/playwright.config.ts (1)

11-13: Consider removing unused MODE references.

The command is now fixed, which correctly aligns with removing the experimental flag. However, the console.info on line 13 and MODE environment variables (lines 38-39) are now non-functional. Consider removing these references in a follow-up cleanup to avoid confusion.

Optional cleanup suggestion
 const baseURL = `http://localhost:${PORT}`
 const command = `pnpm build && pnpm preview --port ${PORT}`
-
-console.info('Running with mode: ', process.env.MODE || 'default')

And in the webServer env section:

 env: {
-  MODE: process.env.MODE || '',
-  VITE_MODE: process.env.MODE || '',
   VITE_NODE_ENV: 'test',
   VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),
   VITE_SERVER_PORT: String(PORT),
   PORT: String(PORT),
 },
e2e/react-router/basic-file-based/playwright.config.ts (1)

11-13: Consider removing unused MODE references.

The fixed command correctly removes experimental flag dependency. However, the console.info on line 13 and MODE environment variables (lines 38-39) are now non-functional and could be removed for clarity.

Optional cleanup suggestion
 const baseURL = `http://localhost:${PORT}`
 const command = `pnpm build && pnpm preview --port ${PORT}`
-
-console.info('Running with mode: ', process.env.MODE || 'default')

And in the webServer env section:

 env: {
-  MODE: process.env.MODE || '',
-  VITE_MODE: process.env.MODE || '',
   VITE_NODE_ENV: 'test',
   VITE_EXTERNAL_PORT: String(EXTERNAL_PORT),
   VITE_SERVER_PORT: String(PORT),
   PORT: String(PORT),
 },
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 090d8bd and 12d9acd.

📒 Files selected for processing (54)
  • docs/router/framework/react/routing/file-naming-conventions.md (0 hunks)
  • docs/router/framework/react/routing/routing-concepts.md (0 hunks)
  • e2e/react-router/basic-file-based/package.json (1 hunks)
  • e2e/react-router/basic-file-based/playwright.config.ts (1 hunks)
  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx (1 hunks)
  • e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx (1 hunks)
  • e2e/react-router/basic-file-based/tests/app.spec.ts (1 hunks)
  • e2e/react-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts (0 hunks)
  • e2e/react-router/basic-file-based/vite.config.js (0 hunks)
  • e2e/solid-router/basic-file-based/package.json (1 hunks)
  • e2e/solid-router/basic-file-based/playwright.config.ts (1 hunks)
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx (1 hunks)
  • e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx (1 hunks)
  • e2e/solid-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts (0 hunks)
  • e2e/solid-router/basic-file-based/vite.config.js (0 hunks)
  • packages/router-generator/src/config.ts (0 hunks)
  • packages/router-generator/src/filesystem/physical/getRouteNodes.ts (1 hunks)
  • packages/router-generator/src/generator.ts (3 hunks)
  • packages/router-generator/src/types.ts (0 hunks)
  • packages/router-generator/src/utils.ts (9 hunks)
  • packages/router-generator/tests/deny-route-group-config.test.ts (2 hunks)
  • packages/router-generator/tests/generator.test.ts (7 hunks)
  • packages/router-generator/tests/generator/append-and-prepend/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/custom-scaffolding/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/custom-tokens/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/dot-escaped/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/export-variations/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/flat-route-group/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/flat/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/nested-layouts/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/nested-verboseFileRoutes-false/tests.nonnested.test-d.ts (0 hunks)
  • packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/nested-verboseFileRoutes-true/tests.nonnested.test-d.ts (0 hunks)
  • packages/router-generator/tests/generator/no-duplicate-route-segment/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/numbers-in-path/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/only-root/routeTree.nonnested.generated.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/only-root/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/path-above-route-in-group/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/prefix-suffix/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/route-groups/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/routeFileIgnore/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/routeFilePrefix/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/single-level/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/types-disabled/routeTree.nonnested.snapshot.js (0 hunks)
  • packages/router-generator/tests/generator/virtual-config-file-default-export/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/virtual-config-file-named-export/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/virtual-inside-nested/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/generator/virtual/routeTree.nonnested.snapshot.ts (0 hunks)
  • packages/router-generator/tests/utils.test.ts (1 hunks)
💤 Files with no reviewable changes (39)
  • packages/router-generator/src/types.ts
  • e2e/solid-router/basic-file-based/vite.config.js
  • docs/router/framework/react/routing/routing-concepts.md
  • e2e/react-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts
  • e2e/react-router/basic-file-based/vite.config.js
  • docs/router/framework/react/routing/file-naming-conventions.md
  • e2e/solid-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts
  • packages/router-generator/src/config.ts
  • packages/router-generator/tests/generator/numbers-in-path/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/no-duplicate-route-segment/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/path-above-route-in-group/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/dot-escaped/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/custom-tokens/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/virtual/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/nested-verboseFileRoutes-false/tests.nonnested.test-d.ts
  • packages/router-generator/tests/generator/route-groups/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/only-root/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/nested-layouts/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/routeFilePrefix/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/custom-scaffolding/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/export-variations/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/flat/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/flat-route-group/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/types-disabled/routeTree.nonnested.snapshot.js
  • packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/virtual-config-file-named-export/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/virtual-inside-nested/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/prefix-suffix/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/virtual-config-file-default-export/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/nested-verboseFileRoutes-true/tests.nonnested.test-d.ts
  • packages/router-generator/tests/generator/only-root/routeTree.nonnested.generated.snapshot.ts
  • packages/router-generator/tests/generator/append-and-prepend/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/single-level/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts
  • packages/router-generator/tests/generator/routeFileIgnore/routeTree.nonnested.snapshot.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript strict mode with extensive type safety for all code

Files:

  • e2e/react-router/basic-file-based/tests/app.spec.ts
  • e2e/react-router/basic-file-based/playwright.config.ts
  • packages/router-generator/src/filesystem/physical/getRouteNodes.ts
  • e2e/solid-router/basic-file-based/playwright.config.ts
  • e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • packages/router-generator/src/generator.ts
  • packages/router-generator/tests/deny-route-group-config.test.ts
  • packages/router-generator/tests/utils.test.ts
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • packages/router-generator/src/utils.ts
  • packages/router-generator/tests/generator.test.ts
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Implement ESLint rules for router best practices using the ESLint plugin router

Files:

  • e2e/react-router/basic-file-based/tests/app.spec.ts
  • e2e/react-router/basic-file-based/playwright.config.ts
  • packages/router-generator/src/filesystem/physical/getRouteNodes.ts
  • e2e/solid-router/basic-file-based/playwright.config.ts
  • e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • packages/router-generator/src/generator.ts
  • packages/router-generator/tests/deny-route-group-config.test.ts
  • packages/router-generator/tests/utils.test.ts
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • packages/router-generator/src/utils.ts
  • packages/router-generator/tests/generator.test.ts
**/package.json

📄 CodeRabbit inference engine (AGENTS.md)

Use workspace protocol workspace:* for internal dependencies in package.json files

Files:

  • e2e/react-router/basic-file-based/package.json
  • e2e/solid-router/basic-file-based/package.json
🧠 Learnings (15)
📓 Common learnings
Learnt from: schiller-manuel
Repo: TanStack/router PR: 6120
File: packages/router-generator/src/generator.ts:654-657
Timestamp: 2025-12-17T02:17:55.086Z
Learning: In `packages/router-generator/src/generator.ts`, pathless_layout routes must receive a `path` property when they have a `cleanedPath`, even though they are non-path routes. This is necessary because child routes inherit the path from their parent, and without this property, child routes would not have the correct full path at runtime.
Learnt from: nlynzaad
Repo: TanStack/router PR: 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: nlynzaad
Repo: TanStack/router PR: 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
Repo: TanStack/router PR: 5402
File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21
Timestamp: 2025-10-08T08:11:47.088Z
Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.
📚 Learning: 2025-10-08T08:11:47.088Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5402
File: packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts:19-21
Timestamp: 2025-10-08T08:11:47.088Z
Learning: Test snapshot files in the router-generator tests directory (e.g., files matching the pattern `packages/router-generator/tests/generator/**/routeTree*.snapshot.ts` or `routeTree*.snapshot.js`) should not be modified or have issues flagged, as they are fixtures used to verify the generator's output and are intentionally preserved as-is.

Applied to files:

  • e2e/react-router/basic-file-based/tests/app.spec.ts
  • e2e/react-router/basic-file-based/playwright.config.ts
  • packages/router-generator/src/filesystem/physical/getRouteNodes.ts
  • e2e/react-router/basic-file-based/package.json
  • e2e/solid-router/basic-file-based/playwright.config.ts
  • e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • packages/router-generator/src/generator.ts
  • e2e/solid-router/basic-file-based/package.json
  • packages/router-generator/tests/deny-route-group-config.test.ts
  • packages/router-generator/tests/utils.test.ts
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • packages/router-generator/src/utils.ts
  • packages/router-generator/tests/generator.test.ts
📚 Learning: 2025-12-17T02:17:55.086Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 6120
File: packages/router-generator/src/generator.ts:654-657
Timestamp: 2025-12-17T02:17:55.086Z
Learning: In `packages/router-generator/src/generator.ts`, pathless_layout routes must receive a `path` property when they have a `cleanedPath`, even though they are non-path routes. This is necessary because child routes inherit the path from their parent, and without this property, child routes would not have the correct full path at runtime.

Applied to files:

  • packages/router-generator/src/filesystem/physical/getRouteNodes.ts
  • e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • packages/router-generator/tests/deny-route-group-config.test.ts
  • packages/router-generator/tests/utils.test.ts
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • packages/router-generator/src/utils.ts
  • packages/router-generator/tests/generator.test.ts
📚 Learning: 2025-10-01T18:31:35.420Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 5330
File: e2e/react-start/custom-basepath/src/routeTree.gen.ts:58-61
Timestamp: 2025-10-01T18:31:35.420Z
Learning: Do not review files named `routeTree.gen.ts` in TanStack Router repositories, as these are autogenerated files that should not be manually modified.

Applied to files:

  • packages/router-generator/src/filesystem/physical/getRouteNodes.ts
  • packages/router-generator/src/generator.ts
  • packages/router-generator/tests/deny-route-group-config.test.ts
  • packages/router-generator/tests/utils.test.ts
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • packages/router-generator/src/utils.ts
  • packages/router-generator/tests/generator.test.ts
📚 Learning: 2025-10-09T12:59:02.129Z
Learnt from: hokkyss
Repo: TanStack/router PR: 5418
File: e2e/react-start/custom-identifier-prefix/src/styles/app.css:19-21
Timestamp: 2025-10-09T12:59:02.129Z
Learning: In e2e test directories (paths containing `e2e/`), accessibility concerns like outline suppression patterns are less critical since the code is for testing purposes, not production use.

Applied to files:

  • e2e/react-router/basic-file-based/package.json
  • e2e/solid-router/basic-file-based/package.json
📚 Learning: 2025-12-06T15:03:07.223Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T15:03:07.223Z
Learning: Applies to **/*.{js,ts,tsx} : Implement ESLint rules for router best practices using the ESLint plugin router

Applied to files:

  • e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx
  • packages/router-generator/tests/utils.test.ts
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • packages/router-generator/src/utils.ts
  • packages/router-generator/tests/generator.test.ts
📚 Learning: 2025-09-22T00:56:49.237Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 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:

  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • packages/router-generator/src/generator.ts
  • packages/router-generator/src/utils.ts
📚 Learning: 2025-09-28T21:41:45.233Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5284
File: e2e/react-start/basic/server.js:50-0
Timestamp: 2025-09-28T21:41:45.233Z
Learning: In Express v5, catch-all routes must use named wildcards. Use `/*splat` to match everything except root path, or `/{*splat}` (with braces) to match including root path. The old `*` syntax is not allowed and will cause "Missing parameter name" errors. This breaking change requires explicit naming of wildcard parameters.

Applied to files:

  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
📚 Learning: 2025-10-01T18:30:26.591Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 5330
File: packages/router-core/src/router.ts:2231-2245
Timestamp: 2025-10-01T18:30:26.591Z
Learning: In `packages/router-core/src/router.ts`, the `resolveRedirect` method intentionally strips the router's origin from redirect URLs when they match (e.g., `https://foo.com/bar` → `/bar` for same-origin redirects) while preserving the full URL for cross-origin redirects. This logic should not be removed or simplified to use `location.publicHref` directly.

Applied to files:

  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • packages/router-generator/src/generator.ts
  • packages/router-generator/tests/utils.test.ts
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
📚 Learning: 2025-10-14T18:59:33.990Z
Learnt from: FatahChan
Repo: TanStack/router PR: 5475
File: e2e/react-start/basic-prerendering/src/routes/redirect/$target/via-beforeLoad.tsx:8-0
Timestamp: 2025-10-14T18:59:33.990Z
Learning: In TanStack Router e2e test files, when a route parameter is validated at the route level (e.g., using zod in validateSearch or param validation), switch statements on that parameter do not require a default case, as the validation ensures only expected values will reach the switch.

Applied to files:

  • e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
  • packages/router-generator/tests/deny-route-group-config.test.ts
  • packages/router-generator/tests/utils.test.ts
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
📚 Learning: 2025-12-17T02:17:47.423Z
Learnt from: schiller-manuel
Repo: TanStack/router PR: 6120
File: packages/router-generator/src/generator.ts:654-657
Timestamp: 2025-12-17T02:17:47.423Z
Learning: In packages/router-generator/src/generator.ts, enforce that pathless_layout routes with a cleanedPath must have a path property. This is required because child routes inherit the parent's path; without a path property, the full path will not resolve correctly at runtime. Update the route type/validation to require path for such routes and add tests ensuring that a pathless_layout with cleanedPath provides a valid fullPath resolution.

Applied to files:

  • packages/router-generator/src/generator.ts
📚 Learning: 2025-09-22T00:56:53.426Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 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-generator/src/generator.ts
  • packages/router-generator/src/utils.ts
📚 Learning: 2025-12-06T15:03:07.223Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T15:03:07.223Z
Learning: Use file-based routing in `src/routes/` directories or code-based routing with route definitions

Applied to files:

  • packages/router-generator/src/generator.ts
  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
📚 Learning: 2025-11-02T16:16:24.898Z
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.

Applied to files:

  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
📚 Learning: 2025-12-06T15:03:07.223Z
Learnt from: CR
Repo: TanStack/router PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-06T15:03:07.223Z
Learning: Implement type-safe routing with search params and path params

Applied to files:

  • e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx
🧬 Code graph analysis (4)
packages/router-generator/src/filesystem/physical/getRouteNodes.ts (1)
packages/router-generator/src/utils.ts (1)
  • determineInitialRoutePath (143-202)
packages/router-generator/src/generator.ts (1)
packages/router-generator/src/utils.ts (5)
  • createRouteNodesByFullPath (507-513)
  • createRouteNodesByTo (518-527)
  • hasParentRoute (445-455)
  • removeUnderscores (268-272)
  • removeLayoutSegments (410-414)
packages/router-generator/tests/utils.test.ts (1)
packages/router-generator/src/utils.ts (2)
  • determineInitialRoutePath (143-202)
  • multiSortBy (77-121)
packages/router-generator/src/utils.ts (4)
packages/router-core/src/path.ts (1)
  • cleanPath (23-26)
packages/router-generator/src/types.ts (1)
  • RouteNode (1-16)
packages/router-core/src/route.ts (1)
  • fullPath (1557-1559)
packages/router-generator/src/config.ts (1)
  • Config (64-64)
⏰ 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). (3)
  • GitHub Check: Test
  • GitHub Check: Preview
  • GitHub Check: autofix
🔇 Additional comments (21)
packages/router-generator/tests/deny-route-group-config.test.ts (1)

15-15: LGTM - Clean removal of nonNested test variants.

The test simplification correctly removes the nonNested flag expansion from test cases. The unconditional route tree path (/routeTree.gen.ts) and simplified test callback align with the broader removal of the experimental feature.

Also applies to: 54-59

packages/router-generator/src/filesystem/physical/getRouteNodes.ts (1)

134-137: LGTM - Simplified path determination.

The destructuring now correctly extracts only routePath and originalRoutePath from determineInitialRoutePath, aligning with the simplified function signature that no longer returns isExperimentalNonNestedRoute.

packages/router-generator/tests/generator.test.ts (2)

47-47: LGTM - Consistent removal of nonNested test infrastructure.

The test harness is correctly simplified:

  • setupConfig uses unconditional route tree path
  • rewriteConfigByFolderName no longer accepts nonNested parameter
  • it.each iterates over folder names directly without nonNested expansion
  • Snapshot paths use unified routeTree.snapshot.{ts|js} naming

Also applies to: 65-65, 237-244


261-261: Snapshot path naming is consistent.

The snapshot paths (routeTree.snapshot.ts, routeTree.generated.snapshot.ts) now use a unified naming convention without nonNested variants, aligning with the removal of the experimental feature.

Also applies to: 308-308

packages/router-generator/tests/utils.test.ts (3)

22-28: LGTM - Tests correctly updated for simplified determineInitialRoutePath.

The tests now call determineInitialRoutePath with just the path string, and assertions correctly expect only routePath and originalRoutePath in the result object.

Also applies to: 31-35, 38-42, 45-49, 52-56, 59-63, 66-70


93-118: Trailing underscore behavior change is intentional.

The tests now expect trailing underscores to be preserved in the routePath (e.g., a_/a_). This aligns with the learnings that underscores should be preserved in base path segments, with the underscore stripping now handled elsewhere in the pipeline (via removeUnderscores in cleanedPath computation).


121-186: Good addition of multiSortBy test coverage.

The new tests provide comprehensive coverage including:

  • Single and multiple accessors
  • Stable sort preservation for equal elements
  • Undefined value handling
  • Edge cases (empty array, single element)
  • Default accessor behavior
  • String sorting and reverse sort via negative accessor
packages/router-generator/src/generator.ts (3)

824-826: LGTM - Simplified route node map creation.

The calls to createRouteNodesByFullPath and createRouteNodesByTo now correctly pass only acc.routeNodes, aligning with the simplified function signatures that no longer require config.


1359-1359: Simplified parent route lookup.

hasParentRoute is now called with 3 arguments (removing node.originalRoutePath), consistent with the updated function signature that no longer needs the experimental non-nested route path.


1374-1376: Streamlined cleanedPath computation.

The path cleaning is now unconditional: removeUnderscores(removeLayoutSegments(node.path)). This replaces the previous conditional logic tied to the experimental non-nested flag. Based on learnings, pathless_layout routes with cleanedPath still correctly receive a path property (handled at line 663).

packages/router-generator/src/utils.ts (4)

143-165: LGTM - Simplified determineInitialRoutePath signature.

The function now accepts only routePath string, removing the config dependency. The underscore (_) is correctly added to DISALLOWED_ESCAPE_CHARS to prevent escaping underscores in brackets, as underscore handling is now done uniformly downstream.


445-455: Simplified hasParentRoute signature.

The function now takes 3 parameters (prefixMap, node, routePathToCheck), removing the originalRoutePath parameter that was used for experimental non-nested route handling. The implementation simply delegates to prefixMap.findParent.


496-502: Config-agnostic path inference functions.

The path inference utilities are correctly simplified:

  • inferFullPath(routeNode) - uniformly applies removeUnderscores(removeLayoutSegments(...))
  • createRouteNodesByFullPath(routeNodes) - no config parameter
  • createRouteNodesByTo(routeNodes) - no config parameter
  • inferTo(routeNode) - delegates to inferFullPath

This aligns with the removal of experimental non-nested route handling throughout the codebase.

Also applies to: 507-512, 518-527, 546-552


720-746: Narrowed config type for buildFileRoutesByPathInterface.

The config parameter is now Pick<Config, 'routeToken'> (optional), and inferFullPath(routeNode) is called without config at line 738. This correctly reflects the simplified inference pipeline.

e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx (1)

8-8: LGTM! Simplified path resolution.

The change correctly replaces experimental flag-dependent path logic with a literal path string that matches the route structure. The path /params-ps/non-nested/$foo_ correctly represents the parent route segment.

e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx (1)

7-11: LGTM! Consistent path simplification.

Both the route API and params hook now use literal paths that correctly match the route definition. This change successfully removes the dependency on the experimental flag while maintaining correct functionality.

e2e/react-router/basic-file-based/package.json (1)

11-12: LGTM! Simplified test script structure.

The removal of nonnested script variants correctly aligns with removing the experimental flag. The test workflow is now streamlined to a single default path.

e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx (1)

8-8: LGTM! Simplified path resolution.

The literal path correctly represents the parent route segment and matches the route definition. Consistent with similar changes across the codebase.

e2e/solid-router/basic-file-based/package.json (1)

11-12: LGTM! Consistent script cleanup.

The simplified test scripts align with the React e2e package and correctly remove the experimental nonnested variants.

e2e/react-router/basic-file-based/tests/app.spec.ts (1)

224-225: Excellent improvement! Navigation synchronization added.

Adding await to the navigation and explicitly waiting for the URL to update prevents race conditions where assertions could run before the navigation completes. This is a best practice for reliable end-to-end tests.

e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx (1)

7-11: LGTM! Path references correctly standardized.

The changes successfully remove the experimental non-nested routes logic by hardcoding the path to /posts_/$postId/edit in both getRouteApi and useParams. The paths are now consistent with the route definition at line 3, ensuring type safety and eliminating conditional behavior.

@nlynzaad nlynzaad merged commit 27d1c5e into main Dec 20, 2025
6 checks passed
@nlynzaad nlynzaad deleted the removed-experimental-nonnested branch December 20, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Everything documentation related package: router-generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants