Skip to content

Conversation

nlynzaad
Copy link
Contributor

@nlynzaad nlynzaad commented Sep 18, 2025

This PR continues on from #5165 and primarily adds additional tests to path resolution and matchByPath for non-nested paths in additiona to e2e test for both react and solid router to verify non-nesting functionality.

One additional issue was picked up for handling of normal path segments.

Summary by CodeRabbit

  • New Features
    • Added non-nested demo routes and navigation examples (including dynamic and edit paths) for React and Solid, with headings, links, and parameter displays.
  • Bug Fixes
    • Improved path parsing/decoding for non-nested segments to prevent unintended nesting and ensure correct parameter values.
  • Tests
    • Added broad unit tests for non-nested path parsing/matching/resolution (case-sensitive/insensitive, wildcards, optional/fuzzy).
    • Added e2e tests validating non-nested navigation and params; reduced e2e flakiness by awaiting network idle.

Copy link
Contributor

coderabbitai bot commented Sep 18, 2025

Walkthrough

Adds non-nested route examples to React and Solid E2E apps (/non-nested, /non-nested/baz, dynamic $bazid, and edit variants), updates generated route trees and tests, adjusts router-core path parsing for non-nested segments, and expands router-core tests for matching and path resolution in non-nested scenarios.

Changes

Cohort / File(s) Summary
React Router — Non-nested routes
e2e/react-router/basic-file-based/src/routeTree.gen.ts, e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx, e2e/react-router/basic-file-based/src/routes/non-nested/baz.tsx, e2e/react-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx, e2e/react-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx
Adds /non-nested route group and child routes (/baz, /baz/$bazid, /baz_/$bazid/edit); updates generated route tree and exports file-route components with params and Outlet usage.
React Router — E2E tests
e2e/react-router/basic-file-based/tests/app.spec.ts
Adds E2E test verifying non-nested links, navigation, and param rendering across /non-nested, /non-nested/baz/:bazid, and /non-nested/baz/:bazid/edit.
Solid Router — Non-nested routes
e2e/solid-router/basic-file-based/src/routeTree.gen.ts, e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx, e2e/solid-router/basic-file-based/src/routes/non-nested/baz.tsx, e2e/solid-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx, e2e/solid-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx
Adds /non-nested route group and child routes for Solid app; updates generated route tree and components exposing params, links, and Outlet.
Solid Router — E2E tests
e2e/solid-router/basic-file-based/tests/app.spec.ts, e2e/solid-router/basic-file-based/tests/redirect.spec.ts
Adds non-nested navigation test; introduces network-idle wait in redirect test to improve synchronization.
Router Core — Path parsing
packages/router-core/src/path.ts
baseParsePathname now decodes the post-normalized segment (partToMatch) for non-%25 segments, affecting decoded values for segments that previously ended with underscores.
Router Core — Tests
packages/router-core/tests/match-by-path.test.ts, packages/router-core/tests/path.test.ts
Adds comprehensive non-nested path test suites (matching, interpolation, resolvePath) and removes some older overlapping non-nested tests; expands coverage for static, param, optional, wildcard, and fuzzy patterns.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant App as App (React / Solid)
  participant Router as Router
  participant Path as Path Parser
  participant RT as Generated Route Tree

  U->>App: navigate to /non-nested... 
  App->>Router: ask for route match
  Router->>Path: baseParsePathname(url)
  Note over Path: normalize trailing '_' for non-nested segments\nthen decode partToMatch (not original part)
  Path-->>Router: segments & params
  Router->>RT: lookup nodes (/non-nested, /baz, /$bazid, /edit)
  RT-->>Router: matched route node(s)
  Router-->>App: render RouteComponent(s) (links, headings, Outlet)
  App-->>U: display UI and params
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

package: react-router, package: solid-router

Suggested reviewers

  • Sheraff
  • schiller-manuel

Poem

I hop through routes both short and long,
/non-nested, /baz — I sing this song.
$bazid found, then edit's in sight,
Params decoded clean and bright.
Tests pass, I twitch my nose — all right! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 "fix(router-core): Non-nested paths" is concise, follows conventional commit style, and accurately highlights the primary focus of the changeset—fixes in router-core related to non-nested path handling; this matches the PR objectives and the changes to packages/router-core plus added non-nested path tests in the e2e suites. It is specific enough for a teammate scanning history to understand the main area affected without listing implementation details. The title is not vague or unrelated to the provided diffs.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch non-nested-paths

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d164b7 and 0fa77f0.

📒 Files selected for processing (4)
  • e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx (1 hunks)
  • e2e/react-router/basic-file-based/tests/app.spec.ts (1 hunks)
  • e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx (1 hunks)
  • e2e/solid-router/basic-file-based/tests/app.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx
  • e2e/solid-router/basic-file-based/tests/app.spec.ts
  • e2e/react-router/basic-file-based/tests/app.spec.ts
  • e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx
⏰ 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

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

Copy link

nx-cloud bot commented Sep 18, 2025

View your CI Pipeline Execution ↗ for commit 0fa77f0

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

☁️ Nx Cloud last updated this comment at 2025-09-18 23:04:26 UTC

Copy link

pkg-pr-new bot commented Sep 18, 2025

More templates

@tanstack/arktype-adapter

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

@tanstack/directive-functions-plugin

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-plugin

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-plugin

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-server-functions-client

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

@tanstack/start-server-functions-fetcher

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

@tanstack/start-server-functions-server

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/zod-adapter

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

commit: 0fa77f0

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 (3)
e2e/solid-router/basic-file-based/tests/app.spec.ts (1)

300-333: Avoid unnecessary awaits on Locators and prefer hidden over viewport checks

getByTestId returns a Locator; await is unnecessary. For the negative checks, toBeHidden is less flaky than not.toBeInViewport().

Apply this diff:

-  const bazIdLink = await page.getByTestId('l-to-non-nested-bazid')
-  const bazIdEditLink = await page.getByTestId('l-to-non-nested-bazid-edit')
+  const bazIdLink = page.getByTestId('l-to-non-nested-bazid')
+  const bazIdEditLink = page.getByTestId('l-to-non-nested-bazid-edit')
@@
-  await expect(bazHeading).not.toBeInViewport()
-  await expect(bazIdHeading).not.toBeInViewport()
+  await expect(bazHeading).toBeHidden()
+  await expect(bazIdHeading).toBeHidden()
e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx (1)

14-31: Consider using consistent structure for links.

The two links render within the same <li> element without separation. Consider placing each link in its own list item or adding appropriate styling/separation between them.

Consider this improved structure:

     <ul class="grid mb-2">
       <li>
         <Link
           from={Route.fullPath}
           data-testid="l-to-non-nested-bazid"
           to="./baz/$bazid"
           params={{ bazid: '123' }}
         >
           /non-nested/baz/123
         </Link>
+      </li>
+      <li>
         <Link
           from={Route.fullPath}
           data-testid="l-to-non-nested-bazid-edit"
           to="./baz/$bazid/edit"
           params={{ bazid: '456' }}
         >
           /non-nested/baz/456/edit
         </Link>
       </li>
     </ul>
packages/router-core/tests/path.test.ts (1)

1542-1562: Consider adding more edge cases for missing splat params.

While the test cases cover basic scenarios with prefix/suffix, consider adding edge cases like empty paths or paths with multiple segments after the splat.

Consider adding these test cases:

{
  name: 'nested splat route without _splat',
  path: '/hello/world/$_',
  params: {},
  expectedResult: '/hello/world',
},
{
  name: 'splat route with multiple prefixes',
  path: '/hello/prefix1{$}prefix2_',
  params: {},
  expectedResult: '/hello/prefix1prefix2',
},
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b69de0 and 6d164b7.

📒 Files selected for processing (16)
  • e2e/react-router/basic-file-based/src/routeTree.gen.ts (39 hunks)
  • e2e/react-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1 hunks)
  • e2e/react-router/basic-file-based/src/routes/non-nested/baz.tsx (1 hunks)
  • e2e/react-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1 hunks)
  • e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx (1 hunks)
  • e2e/react-router/basic-file-based/tests/app.spec.ts (1 hunks)
  • e2e/solid-router/basic-file-based/src/routeTree.gen.ts (39 hunks)
  • e2e/solid-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1 hunks)
  • e2e/solid-router/basic-file-based/src/routes/non-nested/baz.tsx (1 hunks)
  • e2e/solid-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1 hunks)
  • e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx (1 hunks)
  • e2e/solid-router/basic-file-based/tests/app.spec.ts (1 hunks)
  • e2e/solid-router/basic-file-based/tests/redirect.spec.ts (1 hunks)
  • packages/router-core/src/path.ts (1 hunks)
  • packages/router-core/tests/match-by-path.test.ts (1 hunks)
  • packages/router-core/tests/path.test.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (9)
e2e/react-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (3)
e2e/react-router/basic-file-based/src/routes/non-nested/baz.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/baz.tsx (3)
e2e/react-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (3)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (3)
e2e/react-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/baz.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx (3)
e2e/react-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/baz.tsx (1)
  • Route (3-5)
e2e/react-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx (3)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (3)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz.tsx (3)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1)
  • Route (3-5)
e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx (1)
  • Route (3-5)
packages/router-core/tests/path.test.ts (1)
packages/router-core/src/path.ts (8)
  • resolvePath (153-206)
  • trimPathLeft (39-41)
  • interpolatePath (375-489)
  • matchPathname (501-520)
  • SEGMENT_TYPE_PATHNAME (6-6)
  • SEGMENT_TYPE_PARAM (7-7)
  • SEGMENT_TYPE_WILDCARD (8-8)
  • parsePathname (209-219)
⏰ 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 (18)
packages/router-core/src/path.ts (1)

336-345: Correct: decode normalized segment to honor non-nested marker

Decoding partToMatch (post underscore-strip) fixes mismatches for segments like baz_. Please add a couple of regression cases:

  • '/non-nested/baz_/$id' vs actual url /non-nested/baz/123
  • segment containing %25 plus trailing _, e.g. 'abc%25def_''abc%25def'
e2e/react-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1)

7-23: LGTM: dynamic params surfaced with stable test ids

Component is minimal and test-friendly. No issues.

e2e/react-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1)

7-21: LGTM: edit route wiring matches tests

Route path and test ids align with the new e2e assertions.

e2e/react-router/basic-file-based/src/routes/non-nested/baz.tsx (1)

7-14: LGTM: parent outlet for non-nested branch

Parent heading + Outlet behaves as expected for /non-nested/baz and not for the edit branch.

e2e/solid-router/basic-file-based/src/routes/non-nested/baz.tsx (1)

7-14: LGTM: Solid parent with Outlet mirrors React variant

Parity maintained with React route; good for cross-framework tests.

e2e/solid-router/basic-file-based/tests/redirect.spec.ts (1)

58-59: Good flake fix: wait for network idle after race

The extra waitForLoadState('networkidle') stabilizes preload detection before assertions and navigation.

e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx (1)

13-35: LGTM: links generated from Route.fullPath; paths align with non-nested behavior

Relative to targets are clean (no _ in URL) and match the updated parsing.

packages/router-core/tests/match-by-path.test.ts (1)

201-388: LGTM!

The new test suite for non-nested paths comprehensively covers regular path matching, case insensitive matching, and fuzzy matching scenarios, extending the test coverage systematically with wildcard, optional parameter, and static path variations.

e2e/solid-router/basic-file-based/src/routes/non-nested/baz_.$bazid.edit.tsx (1)

1-22: LGTM!

The implementation correctly defines the non-nested edit route for Solid Router with appropriate parameter extraction and rendering. The test IDs align well with the test assertions in the app.spec.ts file.

e2e/solid-router/basic-file-based/src/routes/non-nested/baz.$bazid.tsx (1)

1-23: LGTM!

The route component follows the expected pattern for dynamic parameter routes in Solid Router, correctly extracting and rendering the bazid parameter with appropriate test IDs.

e2e/react-router/basic-file-based/src/routeTree.gen.ts (3)

24-77: LGTM!

The import statements for the new non-nested routes are correctly added and follow the existing naming conventions.


141-201: LGTM!

The route definitions for non-nested paths are correctly configured with appropriate parent-child relationships, IDs, and paths.


1424-1448: LGTM!

The route hierarchy for NonNestedBazRoute and its children is correctly established, following the expected pattern for nested routes.

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

312-345: LGTM!

The end-to-end test thoroughly validates the non-nested path behavior, checking navigation, visibility of components, and correct parameter rendering at each route level.

packages/router-core/tests/path.test.ts (1)

1129-2110: Comprehensive test coverage for non-nested paths!

The test suite provides excellent coverage for non-nested paths across all major path operation functions (resolvePath, interpolatePath, matchPathname, parsePathname). The tests thoroughly validate trailing underscore stripping behavior, parameter extraction, and path resolution with various configurations.

e2e/solid-router/basic-file-based/src/routeTree.gen.ts (3)

23-68: LGTM!

The import statements for the new non-nested routes correctly follow the existing patterns and naming conventions.


126-180: LGTM!

The route definitions are correctly configured with appropriate IDs, paths, and parent relationships matching the expected non-nested structure.


1238-1262: LGTM!

The route hierarchy correctly establishes the parent-child relationships for the non-nested routes, matching the structure in the React Router implementation.

@nlynzaad nlynzaad merged commit cf2346b into main Sep 18, 2025
6 checks passed
@nlynzaad nlynzaad deleted the non-nested-paths branch September 18, 2025 23:05
nlynzaad added a commit that referenced this pull request Sep 18, 2025
nlynzaad added a commit that referenced this pull request Sep 18, 2025
This PR merges the latest updates to main from #5169 and #5165 into
Alpha and brings with it an update to how non-nested paths are parsed.

It also adds additional unit testing for paths and matchByPath as well
as additional e2e tests for react and solid

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
nlynzaad added a commit that referenced this pull request Sep 22, 2025
…n route segments (#5182)

as part of #5169 we made changes to strip underscores from the paths to
ensure it is dealt with correctly during parsing.

inadvertently this stripped it from not only the route segments but also
the base segments. This PR resolves that issue by making
`baseParsePathName` aware which type of segments it is parsing.

a new optional boolean paramater, ```basePathValues```, is introduced in
`baseParsePathName` and `parsePathname` to allow this distinction
between routeSegments and/or basesegments to be passed on to
`baseParsePathName`.

2 new functions are introduced `parseBasePathSegments` and
`parseRoutePathSegments`, which is just wrapper functions around
`parsePathname`, but ensures clearer understanding of what set of
parsing instructions is applied and `basePathValues `is set correctly
based on the requirement.

updated the unit tests to take into account the need not to strip the
base values and also enhanced the e2e tests as well to ensure more
through testing with different usages.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- New Features
- Added non-nested route demos (named, prefix, suffix, path) with
index/foo/bar pages and updated navigation in React and Solid examples.
- Bug Fixes
- Improved path parsing/matching to handle non-nested segments,
prefixes/suffixes and trailing underscores; refined route
sorting/resolution.
- Tests
- Added comprehensive E2E coverage for non-nested paths; removed
obsolete baz-based tests.
- Expanded unit tests for path interpolation and matching (underscore,
prefix/suffix cases).
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant