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

124 commits

Author SHA1 Message Date
Manuel Schiller
17c07d9369
fix: rewrite causes infinite redirects (#6201) 2025-12-23 12:37:09 +01:00
Manuel Schiller
c05572ebbe
fix: streaming (#6175) 2025-12-22 00:13:49 +01:00
Manuel Schiller
f330532e08
fix: generalize hydration cleanup (#6118)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-17 01:18:47 +01:00
Manuel Schiller
20aac85d7f
fix: compare rewritten url to decide if server needs to redirect (#6072) 2025-12-12 20:28:58 +01:00
Manuel Schiller
4d2fd33090
fix: more robust stream handling (#5996) 2025-11-29 21:31:13 +01:00
jihoon
c35f70ec3c
fix(router-core): useBlocker navigation issues for 404 pages and external URLs (#4917) 2025-11-23 01:29:13 +01:00
Shreyas Sarkar
8f5d93b58c
fix: Links always scroll to URL hash on hover (#5930) (#5944) 2025-11-23 01:05:34 +01:00
dt_emmy
3a14ffcea0
chore: Fixed the defaultNotFoundComponent as guided by #5757 (#5937)
* fix: Fixed the defaultNotFoundComponent as guided by  #5757

* ci: apply automated fixes

* fix: correct from <div> to <p> tag

* chore: added docstring to renderRouteNotFound.tsx for both react-router and solid-router

* ci: apply automated fixes

* chore: revert file changes by autofix-ci[bot]

* ci: apply automated fixes

* chore: cleanup documentation of not-found-errors.md

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-22 17:06:28 +01:00
Lee
6b235a7cec
fix: update error handling in MatchInner to access error data directly (#4746) 2025-11-19 19:46:29 +01:00
Birk Skyum
e93b712011
fix(solid-start): fix hydration regression in 1.136.9 (#5903) 2025-11-19 13:32:36 +01:00
Dubzer
27d626f42c
fix: handle $&quot in defaultRenderHandler correctly (#5871) 2025-11-18 23:53:06 +01:00
Manuel Schiller
875d1d4cbb
fix: script streaming (#5895) 2025-11-18 23:28:55 +01:00
Flo
f39eb9b832
refactor(router-core): Process routeTree into segment tree instead of flatRoutes [WIP] (#5722) 2025-11-15 13:45:02 +01:00
Manuel Schiller
af77b55822
fix: cleanup streamed values (#5870) 2025-11-15 01:53:45 +01:00
Flo
043e57656d
refactor(router-core): simplify matchId (#5807)
* refactor(router-core): simplify matchId

* ci: apply automated fixes

* update tests

* matchId !== routeId

* nitpicks

* missed in solid router Match

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Nico Lynzaad <nlynzaad@zylangroup.com>
2025-11-11 00:55:46 +01:00
daveycodez
a41e8677b8
feat: Export useHydrated hook with documentation (#5645)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-09 23:45:42 +01:00
Birk Skyum
01682c5dfb
fix(solid-router): use Solid.useTransition (#5801) 2025-11-09 19:52:29 +01:00
Brenley Dueck
01e0f5aef4
fix(solid-router): dont show fallback unless pendingMinMs > 0 (#5793) 2025-11-08 03:26:11 +01:00
Birk Skyum
76c4f614f2
fix(solid-router): implement navigation transitions (#5691) 2025-11-04 03:51:16 +01:00
Birk Skyum
ce2a6a8a31
fix(solid-router): emit onBeforeRouteMount with createComputed (#5745) 2025-11-03 20:46:59 +01:00
Birk Skyum
d558b67239
fix(solid-router-ssr-query): allow redirect inside server function ssr (#5668) 2025-11-03 17:24:25 +01:00
Birk Skyum
04f137e0a8
fix(solid-router): allow creating link for client-side-routing in SVG (#5667)
* add test

* fix svg links in solid router

---------

Co-authored-by: Brenley Dueck <brenleydueck@gmail.com>
2025-11-01 10:54:36 +01:00
Birk Skyum
a282b9714d
fix(solid-router): Should not remount deps when remountDeps does not change (#5693) 2025-10-30 04:13:48 +01:00
Birk Skyum
f9bf3a5eea
fix(router): bump tanstack store to ^0.8 (#5680) 2025-10-29 02:09:55 +01:00
Birk Skyum
dd8867d46c
test(solid-start): serialization-adapters suite (#5557) 2025-10-27 23:24:45 +01:00
Birk Skyum
e7b90411a5
fix(solid-router): isTransitioning and handleLeave/handleEnter (#5630) 2025-10-26 03:15:57 +01:00
Birk Skyum
4c3bd6bd9d
fix(solid-router): apply style to link (#5628)
* fix(solid-router): apply style to link

* perf

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-10-26 02:28:21 +01:00
Birk Skyum
55393f161d
fix(solid-router): fix external link ref (#5629) 2025-10-26 02:28:03 +01:00
Birk Skyum
08d78c1e2f
test(solid-router): un-skip link tests (#5621) 2025-10-26 00:26:37 +02:00
Brenley Dueck
d6f5870122
fix missing props lazy compoonent (#5597) 2025-10-24 03:20:29 +02:00
Birk Skyum
cc3999f110
fix(solid-router): dev server hydration with pending component (#5585) 2025-10-22 19:57:42 +02:00
Brenley Dueck
0ae2ce05d8
fix: hoist link tags out of body (#5579) 2025-10-21 19:45:34 -05:00
Brenley Dueck
74714e064d
fix: fouc on solid-start HeadContent (#5578)
* fix: fouc on solid-start HeadContent

* ci: apply automated fixes

* fix lint

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-10-21 19:23:28 -05:00
Brenley Dueck
f9ae72c534
fix(solid-start): improve hydration (#5518) 2025-10-21 00:11:31 +02:00
Manuel Schiller
20d3501218
fix: nonce (#5522) 2025-10-18 01:11:47 +02:00
Dominik Dorfmeister
b0d0b25045
fix(react-router,solid-router): top-level Matches should use pendingComponent on root route (#5495) 2025-10-17 19:19:03 +02:00
Edmo Lima
e974ee516d
fix(solid-router): make useLoaderDeps return Accessor for reactivity (#5348) 2025-10-07 01:42:53 +02:00
Manuel Schiller
ceae3d5f85
fix: basepath (#5345) 2025-10-03 14:59:43 +02:00
Lee
e52673bb03
fix(router): hash history links with target="_blank" generate incorrect URLs (#5242) 2025-09-29 21:29:54 +02:00
Manuel Schiller
a255e9db46
fix: nonce support (#5287) 2025-09-29 01:23:59 +02:00
Manuel Schiller
32faee22da
feat: Start RC (#5189)
Co-authored-by: Nico Lynzaad <nlynzaad@zylangroup.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Tanner Linsley <tannerlinsley@users.noreply.github.com>
Co-authored-by: James Opstad <13586373+jamesopstad@users.noreply.github.com>
Co-authored-by: chorobin <chrishorobin@hotmail.com>
Co-authored-by: Tanner Linsley <tannerlinsley@gmail.com>
Co-authored-by: Nico Lynzaad <44094871+nlynzaad@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: hokkyss <hokkyss2@gmail.com>
Co-authored-by: Philippe Serhal <philippe.serhal@gmail.com>
Co-authored-by: Jack Herrington <jherr@pobox.com>
Co-authored-by: Brenley Dueck <brenleydueck@gmail.com>
2025-09-23 11:34:54 -06:00
Manuel Schiller
1d5c5f7776
fix: tell router that rendering finished when rendering to string (#5174)
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 -->
2025-09-20 01:34:03 +02:00
wookhyung
b0ea8de91d
fix(router): prevent script tag duplication in SSR and client-side navigation (#5095)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-09-18 20:09:15 +02:00
Lee
2c8d5ce61e
fix(router): respect target attribute on inner component (#5115) 2025-09-18 20:06:37 +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
Nico Lynzaad
fb04dafb21
fix(react-router, solid-router): reduce useNavigate reactivity on path changes (#5037)
This is a follow-up to #4978.

As picked up by @Sheraff the changes made caused useNavigate to
negatively impact performance specifically with useNavigate being too
reactive to path changes.

This reverts the use of useActiveLocation, that acted as a single
implementation of the logic to determine the from location, and moves
the determination of the from path back to each of Link and useNavigate.
While the core logic is still the same across the implementations the
implication of how it's used and the sources of the required inputs are
different enough that it warrants separate implementations.

This PR does not revert the full change set and still applies to core
reasons and changes for the previous commit in keeping the logic for
determining the from clause the same, i.e. the order of determining the
from path for navigation remains: from clause => current location =>
rendered location.

@Sheraff to advise if this implementation resolves the issues he picked
up.



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

* Breaking Changes
* Removed active-location hooks and their associated types from React
and Solid packages.
* Refactor
* Link and navigation now accept an explicit "from" option instead of
deriving it from active-location state.
* New Features
* Added a programmatic Navigate helper for Solid to trigger navigation
on mount.
* Bug Fixes
* More predictable fallback behavior when no explicit "from" is
provided.
* Performance
  * Reduced state subscriptions for minor efficiency gains.
<!-- 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-08-31 13:48:25 +02:00
Karolis Užkuraitis
4b792b923b
fix(solid-router): RouteProvider Wrap and Match InnerWrap support propagating context to their children (#5033)
Refactored a bit router options.Wrap and options.InnerWrap usage in
RouterProvider and Match components.
Now they will be able to provide context for their children components.

Added few tests for scenarios that were failing before.

Fixes #3744

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

* New Features
* Consistent wrapper handling across routing so routed content and
pending states share the same wrapper/context without adding extra DOM
nodes.
* Exposed createMemoryHistory for memory-based routing in apps and
tests.

* Refactor
* Simplified suspense and wrapper handling for clearer, safer rendering
behavior.

* Tests
* Added tests verifying context propagation through wrappers and into
pending (fallback) states.
<!-- 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-08-29 21:24:38 +02:00
Nico Lynzaad
2df8e52ba0
fix(Relative routing): Default relative routing to current location (#4978)
When using relative routing we have 3 things to consider:

1) Is this relative to the current location? This is specifically
relevant for using `to="."` and `to=".."` in layout routes
2) Is this relative to the rendered route location?
3) Should this be relative to some other route in the tree

We have had a few issues where it hasn't been clear how relative routing
is applied in various scenarios, and where the application differs, for
example `to="."` and `to=".."` was treated differently.

This PR applies the following:
1) when no from path is specified, navigation is done from the current
location, this does not affect absolute paths but makes relative paths
more standardised.
2) other relative navigations require a from location to be specified.

This is achieved by setting Link and useNavigate to default to the
current active location instead of the rendered route location. This
also simplifies the logic in buildLocation as we no longer specifically
cater for `to="."`.

Included in this PR is the required changes to router-core
(buildLocation), react-router and solid-router (Link and useNavigate),
tests for both react-router and solid-router and an update to the docs
to clarify the usage.

This closes #4842

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

* **New Features**
* Added active-location hooks, origin-aware navigation helpers,
programmatic Route API for Link generation, browser-history utilities,
optional from origin for Navigate, and route fullPath exposure.

* **Bug Fixes**
* More deterministic relative navigation (., ..) resolution,
preservation of search/params, and runtime warnings for invalid origins.

* **Documentation**
  * Clarified relative-link semantics and updated examples.

* **Tests**
* Vastly expanded end-to-end coverage for relative navigation, masking,
basepath, and trailing-slash permutations.
<!-- 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-08-26 19:30:31 +02:00
Flo
a7504ae79e
refactor(router-core): simplify defaultParseSearch & defaultStringifySearch (#4985)
Wait for this PR before merging:
https://github.com/TanStack/router/pull/4987. It adds unit tests that
should help make sure we're not breaking anything here.

--- 

The functions used to serialize and deserialize search params are called
*a lot*, but they are creating many unnecessary objects. This PR
refactors
- `encode` to be only as generic as what we need => in practice we only
need to handle 1 value per key (i.e. `.set()` and not `.append()`) so we
don't need a special case for arrays
- `decode` can avoid creating many arrays
- `stringifySearchWith` (and `defaultStringifySearch`) don't need to
pre-stringify the input into a `<string,string>` dictionary as `encode`
now accepts a stringifier function


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

- Breaking Changes
- Removed encode and decode from React Router and Solid Router public
exports.
  - Query string prefix support removed in encode/decode.
- Refactor
- Updated query string handling: arrays encode as comma-separated
values; duplicate keys decode into arrays.
- Streamlined error handling and avoided input mutation; consistent
leading “?” management.
- Tests
- Updated tests to match new encoding/decoding behavior and removed
prefix-related cases.
<!-- 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-08-19 08:42:53 +02:00
Flo
a7b1667827
refactor(router-core): remove pick utility in favor of direct object manipulation (#4983)
Based on the current usage of `pick`, directly addinf the picked keys to
the objects will be less overhead with the same result.

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

- Refactor
- Simplified internal routing logic related to navigation options; no
change to runtime behavior.
- Chores
  - Removed an internal utility no longer used.
- Public API
- One non-essential utility export was removed from package entry
points, slightly reducing the public API surface.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-17 21:26:07 +02:00