-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
refactor(router-generator): remove experimental nonnested paths #6154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis PR removes the experimental Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Specific areas requiring attention:
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
|
View your CI Pipeline Execution ↗ for commit 12d9acd
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this 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
📒 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.tse2e/react-router/basic-file-based/playwright.config.tspackages/router-generator/src/filesystem/physical/getRouteNodes.tse2e/solid-router/basic-file-based/playwright.config.tse2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsxe2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxe2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsxpackages/router-generator/src/generator.tspackages/router-generator/tests/deny-route-group-config.test.tspackages/router-generator/tests/utils.test.tse2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxpackages/router-generator/src/utils.tspackages/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.tse2e/react-router/basic-file-based/playwright.config.tspackages/router-generator/src/filesystem/physical/getRouteNodes.tse2e/solid-router/basic-file-based/playwright.config.tse2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsxe2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxe2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsxpackages/router-generator/src/generator.tspackages/router-generator/tests/deny-route-group-config.test.tspackages/router-generator/tests/utils.test.tse2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxpackages/router-generator/src/utils.tspackages/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.jsone2e/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.tse2e/react-router/basic-file-based/playwright.config.tspackages/router-generator/src/filesystem/physical/getRouteNodes.tse2e/react-router/basic-file-based/package.jsone2e/solid-router/basic-file-based/playwright.config.tse2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsxe2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxe2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsxpackages/router-generator/src/generator.tse2e/solid-router/basic-file-based/package.jsonpackages/router-generator/tests/deny-route-group-config.test.tspackages/router-generator/tests/utils.test.tse2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxpackages/router-generator/src/utils.tspackages/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.tse2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsxe2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxe2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsxpackages/router-generator/tests/deny-route-group-config.test.tspackages/router-generator/tests/utils.test.tse2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxpackages/router-generator/src/utils.tspackages/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.tspackages/router-generator/src/generator.tspackages/router-generator/tests/deny-route-group-config.test.tspackages/router-generator/tests/utils.test.tse2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxpackages/router-generator/src/utils.tspackages/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.jsone2e/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.tsxe2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxe2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsxpackages/router-generator/tests/utils.test.tse2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsxpackages/router-generator/src/utils.tspackages/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.tsxpackages/router-generator/src/generator.tspackages/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.tsxpackages/router-generator/src/generator.tspackages/router-generator/tests/utils.test.tse2e/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.tsxpackages/router-generator/tests/deny-route-group-config.test.tspackages/router-generator/tests/utils.test.tse2e/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.tspackages/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.tse2e/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
routePathandoriginalRoutePathfromdetermineInitialRoutePath, aligning with the simplified function signature that no longer returnsisExperimentalNonNestedRoute.packages/router-generator/tests/generator.test.ts (2)
47-47: LGTM - Consistent removal of nonNested test infrastructure.The test harness is correctly simplified:
setupConfiguses unconditional route tree pathrewriteConfigByFolderNameno longer accepts nonNested parameterit.eachiterates over folder names directly without nonNested expansion- Snapshot paths use unified
routeTree.snapshot.{ts|js}namingAlso 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
determineInitialRoutePathwith just the path string, and assertions correctly expect onlyroutePathandoriginalRoutePathin 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 (viaremoveUnderscoresincleanedPathcomputation).
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
createRouteNodesByFullPathandcreateRouteNodesByTonow correctly pass onlyacc.routeNodes, aligning with the simplified function signatures that no longer require config.
1359-1359: Simplified parent route lookup.
hasParentRouteis now called with 3 arguments (removingnode.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 withcleanedPathstill correctly receive apathproperty (handled at line 663).packages/router-generator/src/utils.ts (4)
143-165: LGTM - Simplified determineInitialRoutePath signature.The function now accepts only
routePathstring, removing the config dependency. The underscore (_) is correctly added toDISALLOWED_ESCAPE_CHARSto 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
originalRoutePathparameter that was used for experimental non-nested route handling. The implementation simply delegates toprefixMap.findParent.
496-502: Config-agnostic path inference functions.The path inference utilities are correctly simplified:
inferFullPath(routeNode)- uniformly appliesremoveUnderscores(removeLayoutSegments(...))createRouteNodesByFullPath(routeNodes)- no config parametercreateRouteNodesByTo(routeNodes)- no config parameterinferTo(routeNode)- delegates toinferFullPathThis 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
configparameter is nowPick<Config, 'routeToken'>(optional), andinferFullPath(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
awaitto 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/editin bothgetRouteApianduseParams. The paths are now consistent with the route definition at line 3, ensuring type safety and eliminating conditional behavior.
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
✏️ Tip: You can customize this high-level summary in your review settings.