0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
Commit graph

6,494 commits

Author SHA1 Message Date
Shruti Kapoor
fb4c6a1b82
docs: Tutorial: Fetching data from an external API (#5050)
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>
2025-09-16 20:30:48 -06:00
Shruti Kapoor
e4a3e74a29
docs: Moving images inline and changing urls to relative (#5072)
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>
2025-09-16 20:29:49 -06:00
Prateek Karki
1405da71ed
docs: Fix grammatical error (#5148) 2025-09-16 20:12:24 +02:00
Sarah
8a15c49e5d
Update README (#5152)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-09-16 20:12:10 +02:00
Tanner Linsley
5566ada217 release: v1.131.44 v1.131.44 2025-09-15 10:58:54 +00:00
Vedant Pahune
bfc466ffd3
fix: restore InferStructuralSharing and handleHashScroll in published .d.ts files (#5134)
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 -->
2025-09-15 12:52:34 +02:00
Tanner Linsley
f65072eef1 release: v1.131.43 v1.131.43 2025-09-13 00:48:33 +00:00
Sean Cassiere
96bde26a90
fix(router-plugin): show warning for non-splittable items (#5145) 2025-09-13 12:47:02 +12:00
autofix-ci[bot]
9a728b67b6
ci: apply automated fixes 2025-09-12 22:00:41 +00:00
Pavel Rakhmanov
ff07b8135f
docs: fix invalid JSX on selective-ssr documentation page (#5142) 2025-09-12 23:59:50 +02:00
Tanner Linsley
a286e6becb release: v1.131.42 v1.131.42 2025-09-12 11:21:42 +00:00
Sean Cassiere
081b949d99
fix(router-devtools-core): add copy to clipboard for search params object (#5140) 2025-09-12 23:18:29 +12:00
Tanner Linsley
ca84fb05f3 release: v1.131.41 v1.131.41 2025-09-11 21:29:10 +00:00
Nico Lynzaad
2b6789baa6
fix(router-core): _strictParams and path defining characters (#5135)
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 -->
2025-09-11 23:27:28 +02:00
Tanner Linsley
a60022301c release: v1.131.40 v1.131.40 2025-09-11 16:59:03 +00:00
Flo
d681a0cf66
refactor(router-core): processRouteTree sorting uses constants for all score modifiers (#5131)
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>
2025-09-11 18:57:29 +02:00
Tanner Linsley
5d6cb80fd7 release: v1.131.39 v1.131.39 2025-09-11 16:34:03 +00:00
Flo
65c07d7e99
refactor(router-core): processRouteTree in its own file (#5128)
- 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>
2025-09-11 18:32:17 +02:00
Tanner Linsley
e2167659cd release: v1.131.38 v1.131.38 2025-09-11 15:09:09 +00:00
Nico Lynzaad
b6a98805cc
fix(router-core): params.parse should run as minimally as possible (#5124)
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 -->
2025-09-11 17:07:28 +02:00
Tanner Linsley
9a86563ae0 release: v1.131.37 v1.131.37 2025-09-11 07:29:36 +00:00
Nico Lynzaad
8f8f03fbdc
fix(router-core): parse _strictParams. (#5120)
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 -->
2025-09-11 09:27:55 +02:00
Robert Soriano
6167c0c60d
chore(examples): Update Clerk server handler usage (#5026)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-10 19:33:13 +02:00
Nico Lynzaad
834128ea84
docs: Integration with Esbuild - update title to reflect "Esbuild" (#5112)
The integration with Esbuild page's title is reflecting as Vite.

This PR updates it to reflect as "Esbuild"
2025-09-09 14:34:01 +02:00
Nico Lynzaad
a0e4641728
docs: resolve invalid relative paths (#5111)
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 -->
2025-09-09 14:30:57 +02:00
Kilian Finger
d939463e93
docs: fix external data loading path (#5109)
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 -->
2025-09-09 13:32:06 +02:00
Tanner Linsley
99d9044657 release: v1.131.36 v1.131.36 2025-09-08 04:22:24 +00:00
Nico Lynzaad
907b1f7ce9
fix: release (#5104)
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 -->
2025-09-08 06:20:54 +02:00
Nico Lynzaad
22c9888857
fix(react-router, solid-router) - useParams should only be concerned about the relevant params (#5097)
#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 -->
2025-09-07 11:35:09 +02:00
Jakob Norlin
6202162dd3
docs: change hydration target to document.body in custom client.tsx for Solid (#5091)
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 -->
2025-09-05 19:07:19 -05:00
Flo
fbedc50668
test(router-core): add initial tests for router behavior (#4993)
First PR to add framework agnostic unit tests covering router behavior.
We need to add many more (and eventually lighten the tests in each
framework).

This PR adds tests about when a beforeLoad and a loader should execute.

Next PR should add tests about how context is passed.

Look at these issues to see what should be tested:
https://github.com/TanStack/router/issues/4696

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

* **Tests**
* Added comprehensive tests validating preload behavior for route
loading hooks (beforeLoad and loader), covering resolved, pending, and
rejected outcomes including notFound and redirects.
* Verifies navigation control flow, hook invocation counts, pending vs
cached matches, final locations, and loader data handling.
* Includes sibling-route "stay" scenarios and timing helpers to
strengthen async/timing reliability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-05 23:59:13 +02:00
Ian J. MacIntosh
741821b2d2
docs(start): Add Railway instructions (#4910)
I was puzzled why Railway wasn't starting a server, then realized
TanStack Start doesn't define the start command by default
2025-09-04 21:49:49 -05:00
Yağız Yorulmazlar
e83fb3b740
docs: Rename Link Preloading Timeout to Link Preloading Delay (#5082)
The current `Link` component doesn't have `preloadTimeout` prop as
stated in the docs. This PR updates documentation to use the correct
`preloadDelay` prop.

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

## Summary by CodeRabbit

* **Documentation**
* Updated terminology from “Link Preloading Timeout” to “Link Preloading
Delay” to improve clarity.
* Revised examples to use the preloadDelay option instead of
preloadTimeout.
  * Clarified that the default delay remains 50 ms.
* Ensured consistency across headings, descriptions, and code snippets
to match the current public API.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-04 21:24:27 -05:00
Maximilian
e9d4c5b674
chore: fix typo and move route callback for start-workos example (#5048)
Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-09-05 08:40:27 +12:00
autofix-ci[bot]
df4abd267a
ci: apply automated fixes 2025-09-04 20:26:58 +00:00
Nitin Gupta
f8f47d59aa
Added Prisma as a partner in relevant places (#5086)
Inserted relevant logo files and/or blurbs re: Prisma Postgres in the
relevant places. Please review and edit as you see fit.

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

- Documentation
- Added a Prisma partner tile to the Partners section, linking to
prisma.io with tracking parameters and logo.
- Introduced a Prisma Postgres subsection in the React databases guide
with dark/light logos, feature highlights (edge-optimized, fits your
stack, web UI, auto-scaling, unikernel isolation), and CTAs; placed
after Neon.
- Added Prisma to the TanStack Start funded partners overview with logo
and description, positioned between Neon and Convex.
  - No functional or API changes.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
2025-09-04 14:26:10 -06:00
Tanner Linsley
e02201312d release: v1.131.35 v1.131.35 2025-09-04 08:48:41 +00:00
Nico Lynzaad
cb0b6928d6
fix(router-core): reduce maskedLocation builds (#5081)
As highlighted by #5062 when using a mask, the location is being built
multiple times.

While we need to build the next path as well as the mask, the mask is
being built twice. this PR fixes that by using the first build of the
mask as the maskedLocation for the next path.

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

## Summary by CodeRabbit

* **Refactor**
* Optimized routing logic to avoid redundant work when applying masked
destinations, reducing unnecessary computation during navigation. No
changes to behavior or public APIs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-04 10:47:08 +02:00
autofix-ci[bot]
f158256bd4
ci: apply automated fixes 2025-09-03 23:41:01 +00:00
HaydenB
540a2bd8a1
docs: Adding note regarding yarn workspace usage (#5073) 2025-09-04 01:40:11 +02:00
Tanner Linsley
8196ba1573 release: v1.131.34 v1.131.34 2025-09-03 19:55:59 +00:00
Flo
3db4eb98ee
refactor(router-core): isMatch perf (#5075)
idk when this function is used, but this is an easy win

```sh
 ✓  @tanstack/router-core  tests/match-by-path.bench.ts > isMatch 3251ms
     name                           hz     min     max    mean     p75     p99    p995    p999     rme  samples
   · new implementation  10,695,733.21  0.0000  1.0057  0.0001  0.0001  0.0001  0.0002  0.0003  ±0.43%  5347867   fastest
   · old implementation   7,647,886.94  0.0000  0.1493  0.0001  0.0001  0.0002  0.0002  0.0003  ±0.08%  3823944

 BENCH  Summary

   @tanstack/router-core  new implementation - tests/match-by-path.bench.ts > isMatch
    1.40x faster than old implementation
```

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

## Summary by CodeRabbit

* **Refactor**
* Optimized internal path-matching logic to reduce array mutations and
improve performance during route resolution.
* Improves efficiency and lowers memory churn in navigation-heavy
scenarios.
  * No changes to expected behavior or public APIs.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-03 21:49:28 +02:00
Flo
777e152d9f
refactor(router-core): redirect doesn't need to create an empty object for headers init (#5076)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Streamlined header initialization in redirect handling to rely on
default behavior when no headers are provided.
* Improves consistency and reduces implicit assumptions in header
processing without altering existing behavior.

* **Chores**
* Minor internal cleanup to align with standard header handling
patterns.

No functional changes are expected for end-users; redirects and related
headers continue to behave as before.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-03 21:48:47 +02:00
Tanner Linsley
453790b723 release: v1.131.33 v1.131.33 2025-09-03 16:51:07 +00:00
Flo
dc45979f1f
fix(router-core): replaceEqualDeep works w/ null prototype objects (#5080)
Fix https://github.com/TanStack/router/issues/5078

I had not pushed this before because ESLint was angry w/ me, and now
stuff breaks :'(

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

## Summary by CodeRabbit

* **Bug Fixes**
* Improved reliability when comparing and updating objects with null
prototypes, addressing edge-case behavior and preventing unexpected
failures.
* Hardened own-property checks to behave consistently across different
object shapes.
  * No changes to the public API.

* **Tests**
* Added coverage for handling objects created without a prototype to
ensure correct comparison and update behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-03 18:49:41 +02:00
hokkyss
bc5e78f04c
docs(start): environment functions for createIsomorphicFn and envOnly (#4806) 2025-09-03 15:40:25 +12:00
Manuel Schiller
31783149e5 docs: document shellComponent 2025-09-02 20:55:42 +02:00
Tanner Linsley
fec3509d7a release: v1.131.32 v1.131.32 2025-09-02 12:31:46 +00:00
Flo
ad3ab7fbb6
refactor(router-core): unify replaceEqualDeep implementation w/ query (#5067)
Following https://github.com/TanStack/query/pull/9604, this PR
replicates the implementation of `replaceEqualDeep` here, so that both
are more similar (avoid drifting apart over time).

There are no performance changes.

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

## Summary by CodeRabbit

- Performance
- Optimized internal deep-compare and replacement logic to short-circuit
equal values and avoid unnecessary recursion, improving route state
updates. Users may see faster navigations and reduced CPU usage in
complex scenarios.

- Refactor
- Simplified internal implementation while preserving existing behavior
and public APIs. No functional changes or breaking changes for
consumers.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-02 14:30:20 +02:00
autofix-ci[bot]
5b5f792e3f
ci: apply automated fixes 2025-09-01 17:29:58 +00:00