Tiny fix 😊
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Corrected middleware chaining in the React static server functions
example, replacing an erroneous double-dot with proper single-dot method
chaining.
* Example now compiles and accurately reflects the fluent API, improving
clarity for readers.
* No changes to public APIs or runtime behavior; this is a documentation
fix to prevent developer confusion.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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 -->
fixes#5155
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved server-side rendering stability by correctly finalizing the
initial render before injecting additional HTML, preventing rare hangs
or incomplete pages.
* Applies to both React and Solid router SSR paths.
* **Performance**
* Slightly reduces SSR latency by signaling render completion earlier in
the pipeline.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## 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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
When parsing path params to interpolate the path non-nested path params
```/path/$param_``` was being parsed in the same manner as regular path
params ```/path/$param```.
This PR adds consideration for the trailing underscore when parsing the
path for non-nested path params as well as unit tests on path
interpolation and e2e tests for useParams to ensure this is parsed
correctly and updates correctly when params change.
This resolves#5164
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Support trailing-underscore non-nested path params (e.g., /users/$id_
→ /users/123).
- UI shows an additional navigation link for the non-nested route
(/params-ps/non-nested/foo2/bar2) and improved link display text.
- Tests
- Expanded React and Solid e2e tests to cover the new link, navigation,
and param parsing for foo2/bar2.
- Added unit tests validating interpolation/matching for the $param_
syntax.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
I noticed a slight performance dip during some navigations and the
bottom-up call list of the flame graph seemed to point to the
`composeHandler`. This seems (surprising and) pretty minor, but I'm
measuring a consistent 3ms self-time when the resulting handler is
actually being called.
This PR proposes ditching array methods and using a `for-of` loop. This
is good-enough™ and preserves the generality and DX of this function for
a 25% perf improvement.
```sh
✓ @tanstack/react-router tests/foo.bench.tsx > composeHandlers 10064ms
name hz min max mean p75 p99 p995 p999 rme samples
· array methods 37,152,711.10 0.0000 0.1624 0.0000 0.0000 0.0000 0.0000 0.0002 ±0.14% 18576357
· for-of 47,029,751.81 0.0000 0.0236 0.0000 0.0000 0.0000 0.0000 0.0001 ±0.07% 23514876 fastest
BENCH Summary
@tanstack/react-router for-of - tests/foo.bench.tsx > composeHandlers
1.27x faster than array methods
```
A slightly more performant (~30%) version would be to handle *exactly* 2
handlers instead of an arbitrary number (since `composeHandlers` is only
used w/ 2 callbacks) but this does affect the generality and DX of this
function.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Updated link event handling to short-circuit when an action is
prevented, maintaining existing behavior.
- Streamlined internal logic for handling user interactions with links
for improved efficiency.
- **Performance**
- Minor efficiency improvements in link interaction handling without
altering the public API or user-facing behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Adding a new tutorial to Docs -> Tutorials
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* Documentation
* Added a step-by-step tutorial showing server-side route-loader
fetching from an external API into a TanStack Start React app (TMDB
example), covering project setup, env token usage, data flow (SSR),
loading/error states, UI samples, and testing instructions
(/fetch-movies).
* Chores
* Added a Tutorials entry linking the new guide into the React
documentation navigation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Incorporating feedback from PR -
https://github.com/TanStack/router/pull/4089. Changes made -
1. Moved images to `assets` folder on suggestion
2. Changed URLs from absolute to relative.
3. Adding an in-line sequence diagram
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Newly added jokes now receive unique identifiers, improving
reliability when creating new entries.
* **Documentation**
* Updated links to internal paths for SSR, router concepts, and React
Query sections.
* Switched images to repository-hosted assets for consistency and
availability.
* Replaced the data flow image with an inline Mermaid sequence diagram
covering home-page loading and add-joke flows, including data refresh
behavior.
* Minor formatting cleanup.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Fixes#5116
### Root Cause
In PR #4907, the TypeScript compiler option `stripInternal` was enabled
in tsconfig.json, which causes TypeScript to remove any declarations
marked with `@internal` from the published `.d.ts` files.
This resulted in TypeScript compilation errors for library users who
have set the TypeScript compiler option `skipLibCheck` to `false`,
because the following members were missing:
- `InferStructuralSharing` type in `react-router`
- `handleHashScroll` function in `router-core > scrollRestoration`
### Fix
- This PR replaces the `@internal` annotation with the `@private`
annotation.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Updated internal API annotations in routing packages to mark certain
items as private, improving the accuracy of generated developer
documentation.
* No changes to public APIs, behavior, or performance.
* No user-facing impact.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This PR resolves#5133 by making the _strictParams more conscious of
path defining characters and other wildcards. It also adds e2e tests for
react and solid
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added “Non-nested path params” pages and links in React and Solid
basic-file-based e2e tests at /params-ps/non-nested, plus nested dynamic
routes to view single and combined params; UI links and outlets
included.
- **Bug Fixes**
- Improved internal path-parameter resolution so strict param extraction
uses the full route path for more accurate matching.
- **Tests**
- Added end-to-end tests verifying navigation to
/params-ps/non-nested/foo/bar and correct partial vs. full param values.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Just to make it easier to tweak the values and understand the scales /
functions, we extract all score modifiers to constants w/ descriptive
names.
This PR is a no-op, no logic was modified.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- Bug Fixes
- Improved route matching accuracy by prioritizing routes with static
segments that appear after dynamic parameters.
- More predictable matching in complex paths; reduces unexpected
selections.
- Wildcard routes handled more consistently.
- Refactor
- Updated internal route scoring to consider deeper static segments
without changing the public API.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- move `processRouteTree` to a separate file because the logic is very
self-contained
- create a new function `sortRoutes` w/ the sorting logic, so it can be
tested independently
This PR is a no-op, we're just moving code around, *nothing* was
changed.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Added a public Route type for describing route objects in route trees.
- Refactor
- Consolidated route processing into a dedicated module for clearer
separation and maintainability.
- Updated public exports for route processing; existing imports may need
to be adjusted.
- No runtime behavior changes expected.
- Tests
- Updated tests to use the new public Route type and revised import
paths.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
resolves#5123 and adds checks to tests to ensure this runs as minimally
as possible
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Performance**
* Reuses existing route matches to reduce redundant param parsing and
stabilize navigation/loading behavior.
* **Tests**
* Updated tests to match the new postId param shape, navigation paths,
and parameter displays; added mocks to verify param parsing calls.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
with changing useParams to make use of _strictParams it became apparent
that _strictParams did not apply param parsing correctly. This PR
resolves that problem and hence useParams now return the parsed params
correctly.
This PR also adds unit tests in both react-router and solid-router to
test this expected result.
A separate PR has been created to merge into alpha (#5121)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Stricter route parameter parsing and validation with support for
custom parse/stringify.
- Clearer per-route parameter error reporting, with optional
throw-on-error behavior.
- More consistent parameter values across nested routes and loaders.
- Tests
- Added integration tests validating useParams with nested routing,
custom param parsing/stringifying, and loader data in both React and
Solid routers.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
paths in "migrate from react location" and "migrate from react-router"
to the installation docs form installing Tanstack router returns 404.
This PR fixes the incorrect relative paths.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Updated installation guide links in the React migration guides for
TanStack Router to point to the correct “How to Install” page.
* Ensures migration steps reference the right documentation, improving
navigation for users following the guides.
* No functional or code changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
The link to External Data Loading on the [Query
Integration](https://tanstack.com/router/latest/docs/integrations/query)
page currently throws a 404.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Corrected a link in the Router integrations guide to point to the
proper External Data Loading page in the React framework section. This
fixes navigation from that note and ensures readers can access the
referenced guidance without errors. No functional changes to the
product; content remains otherwise unchanged and reduces confusion.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
release
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Minor punctuation update in inline documentation comments to maintain
consistency.
* No changes to features, user interface, performance, or behavior.
* APIs, configuration, and compatibility remain unaffected.
* This update is purely editorial and does not alter builds,
deployments, or runtime.
* Users and integrators do not need to take any action.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
#5020 highlighted an issue where when using useParams in parent route
(that has its own path param) with child routes that also use path
params this can cause excessive re-rendering of the parent route when
the params for the child routes changes.
The root cause for this is that the child params are available to the
parent route, even when strict=false was not specified and this also
does not match to the types that is being returned in this case. This
can be worked around by using select inside the useParams hook/function
but results in unnecessary boilerplate.
This PR attempts to resolve the issue by dealing with the two distinct
cases, one where we are only concerned about the path params of the
current route and prior routes (strict=true/undefined) and the second
where we want access in the parent route to the path params of the child
routes (strict=false).
In the strict case we use the match id to return the params of the
specific match, which is constant and results in stable rendering, while
in the strict=false case we fallback to the initial implementation of
returning params from the useMatch result which can be variable and
requires re-rendering to be done.
Changes were done on useParams for both react and solid, in solid's case
this wasn't causing re-renders but did return unexpected child params,
the change for solid is more toward keeping the API and expected outputs
consistent between the two frameworks. existing unit tests for react was
updated and e2e tests for both frameworks was added to ensure rendering
and results match the expected.
A separate merge has been prepared for Alpha and will be merged on
signoff of this one.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added nested named-parameter routes (three-level: foo → bar → baz) in
example apps with nested navigation, outlets, links and render-count
displays.
- Added a small render-counter component to visualize component
re-renders.
- **Bug Fixes**
- Improved params selection to respect strict vs non-strict modes,
reducing excess renders and producing stable param values.
- **Tests**
- Added E2E tests for React and Solid examples covering param navigation
and render-counts; expanded router unit tests for nested-route stability
and remount behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Fixes#5085
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Updated the Solid framework “Learn the Basics” guide to correct the
client hydration example, targeting the appropriate DOM root.
* Clarifies which element to hydrate, aligning the snippet with current
best practices and reducing confusion for readers.
* Improves copy‑paste reliability of the example for newcomers following
the setup steps.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->