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

66 commits

Author SHA1 Message Date
Flo
7b4dcee399
refactor(router-core): index routes have index nodes in the segment tree (#6171) 2025-12-21 16:32:19 +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
06de1f6777 flaky tests 2025-12-10 00:44:41 +01:00
Manuel Schiller
e681a56f05
fix: commit route context (#6053)
Co-authored-by: Jakob Norlin <jakob.stahl91@gmail.com>
2025-12-09 21:17:36 +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
Flo
5e130d7ee1
refactor(router-core): interpolatePath skips optional segments w/ nullish param value (#5934) 2025-11-21 23:55:16 +01:00
Remi
37eb416963
fix(router-core): Catch errors thrown during hydrate (#5686) 2025-11-19 21:06:05 +01:00
Lee
6b235a7cec
fix: update error handling in MatchInner to access error data directly (#4746) 2025-11-19 19:46:29 +01:00
dt_emmy
fb0f069363
fix(router-core): Route with server function as loader that throws notFound crashes route on HMR #5763 (#5890) 2025-11-19 17:34:32 +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
Nico Lynzaad
f1bd5c589c
refactor(router-core): use original nextTo path when building location in its route form (#5851)
* fixes and tests

* standardize params output for empty optional params

* finalize leave params tests

* leave wildcard is no longer required

* remove leaveParams altogether

* leave changes to optional param output handling for a separate PR

* cleanup

* resolve build errors and nitpick
2025-11-14 01:55:39 +02:00
Birk Skyum
7880ad7b46
fix(solid-start): navigation transitions (#5792) 2025-11-09 21:33:59 +01:00
Birk Skyum
01682c5dfb
fix(solid-router): use Solid.useTransition (#5801) 2025-11-09 19:52:29 +01:00
Birk Skyum
da770787fa
fix(solid-router): setting search params with 2 parallel navigate calls (#5797) 2025-11-09 16:09:18 +01:00
Ramy Ben Aroya
c857362929
fix(router-core): trigger abort signal when navigating away after pendingMs (#5777)
* fix(router): trigger loader abort signal when navigating away after pendingMs

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-08 01:37:07 +01:00
Nico Lynzaad
26f23faf13
refactor(router-core): consistent Unicode handling (#5736)
* add router-core fixes and update tests

* update react-router unit tests

* update react-router e2e tests

* update solid-router unit tests

* update solid-router e2e tests

* update test description

* rename function

* rename test as per codeRabbit nitpick

* test cleanup
2025-11-06 03:35:59 +02:00
Birk Skyum
76c4f614f2
fix(solid-router): implement navigation transitions (#5691) 2025-11-04 03:51:16 +01:00
Birk Skyum
2d338e0156
test(router): wait for nav to complete (#5744) 2025-11-03 20:24:04 +01:00
Birk Skyum
219b72cf4b
test(router): set notFoundComponent in statusCode test (#5742)
test(router): set notfound component in statusCode test
2025-11-03 19:54:27 +01:00
Birk Skyum
470f9b63bf
test(router): add waitFor for page navigation link/optional-path-params (#5741) 2025-11-03 19:33:43 +01:00
Birk Skyum
bd37f613ed
test(solid-router): align Matches to react (#5695) 2025-10-30 06:31:56 +01:00
Nico Lynzaad
915de641cd
refactor(router-core): more stable url decoding (#5663)
* add decode path segment util

* ensure navigation and browsing to path has same encoding/decoding

* add e2e tests

* add test recommendations

* nitpick

* minor enhancements

* build array once

* add additional unit and e2e tests

* remove react import from solid test

* nitpicks

* final nitpicks

* use history.push
2025-10-28 23:33:50 +02:00
Birk Skyum
08d78c1e2f
test(solid-router): un-skip link tests (#5621) 2025-10-26 00:26:37 +02:00
Birk Skyum
735c1e3384
test(solid-router): fix timing in loaders test (#5622) 2025-10-26 00:26:19 +02:00
Birk Skyum
f4a544f405
test(solid-router): sync unit tests from react-router (#5614) 2025-10-25 19:21:19 +02:00
Paul Sachs
3eccdebd0a
fix(router-core): add support for handling any kind of empty _splat consistently (#5510)
* Add support for handling any kind of empty _splat consistently

* Add navigate test for empty spat

* Added useNavigate test

* Added full trailingSlash options testing matrix

* Refactored the trailing slash cases

* export trailingSlashOptions from router-core

* replicate tests for solid

* ci: apply automated fixes

* fix test name interpolation

* correct waitFor usage

* fix eslint error

---------

Co-authored-by: Nico Lynzaad <44094871+nlynzaad@users.noreply.github.com>
Co-authored-by: Nico Lynzaad <nlynzaad@zylangroup.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-10-21 01:13:39 +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
Lee
e52673bb03
fix(router): hash history links with target="_blank" generate incorrect URLs (#5242) 2025-09-29 21:29:54 +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
Lee
2c8d5ce61e
fix(router): respect target attribute on inner component (#5115) 2025-09-18 20:06:37 +02: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
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
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
642964e4e3
refactor(router-core): reduce buildLocation object allocations (#4981)
When we can (and it's reasonable), it's always beneficial to reduce the
number of objects we create in JS, so as to minimize the memory pressure
and the GC work.

`buildLocation` gets called pretty often, so removing a few object
allocations can be very beneficial (especially inside loops).

Also, from a purely "immediate performance" point of view,
`Object.assign` tends to be faster than `{...foo}`.

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

* **Refactor**
* Route parameter and search handling now use in-place updates to reduce
allocations and streamline iteration/control flow; behavior and public
API remain unchanged.
* **Tests**
* Updated tests to capture cloned parameter objects and assert on exact
values rather than relying on mock call history, preventing
mutation-related flakiness.
<!-- 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-17 18:35:45 +02:00
Flo
d6a77e1d6b
refactor(router-core): flatten loadMatches (#4961)
This PR *should* be a no-op. Just restructuring the code to have all the
functions used by `loadMatches` at the same level, instead of nested
callbacks. In order to still have access to the data that was previously
in scope because of nesting, we use a `innerLoadContext` object, which
is basically just the arguments of `loadMatches`, and a few mutables.

However, in order to do so, we have to rearrange promises in an area
that is sensitive to any microtask order change, and we did change some
of them. So this is not *really* a no-op, even though this does not
attempt any optimization.

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

## Summary by CodeRabbit

- New Features
- Smoother navigations with predictable pending states and minimum
display durations.
  - More consistent head/meta updates after route loading.
- Bug Fixes
- More reliable redirects and 404 handling, including during preloading
and SSR.
  - Reduced UI flicker by refining pending and preloading behavior.
- Refactor
- Reworked the routing load pipeline for improved performance,
stability, and SSR behavior.
- Streamlined before-load steps for clearer, more consistent execution.
- Tests
  - Updated tests to reflect the new loading flow.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-15 23:19:56 +02:00
Sean Cassiere
63c6df8d13
test(solid-router): add test from #4930 (#4941) 2025-08-13 13:36:12 +12:00
Manuel Schiller
3c6633a705
chore: silence error in test (#4794)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-26 23:05:17 +02:00
Jaen
e83199310a
feat(react-router): add disableGlobalCatchBoundary option (#4765)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Manuel Schiller <manuel.schiller@caligano.de>
2025-07-26 22:45:20 +02:00
wookhyung
7c6d4c1325
fix(router-core): reset statusCode to 200 on navigation start (#4664)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-18 00:25:35 +02:00
Flo
89c7b5d660
test(react-router,solid-router): test re-render for preload='viewport' (#4672) 2025-07-17 19:15:11 +12:00
Indrek Ardel
db1331f9b8
tests(solid-router): enable ClientOnly SSR test (#4666) 2025-07-16 19:58:35 +02:00
Indrek Ardel
ba590c2111
fix(solid-router): prevent client effects running on server (#4621) 2025-07-15 22:19:37 +02:00
Nico Lynzaad
96032358b2
fix: buildLocation check for non changing routes - consider trailing slashes (#4581)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-06 18:22:11 +02:00
Brenley Dueck
eb8a5f0773
fix(solid-router): loaders being called twice during SSR (#4574)
Basically my understanding is that the `load` function gets called once
during SSR but right now our `Transitioner` calls it again as it appears
`createRenderEffect` run on the server too where as the `useEffect` in
React doesn't.

The fix is just to bail out if its running on the server. Feels kinda
hacky but it works.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-06 07:54:13 +02:00
Felipe Stanzani
ceec4f2102
feat: Add style to HeadContent (#4559)
Currently Route HeadContent don't have support to inline style tags.

After a contribution proposition made by @schiller-manuel in the Discord
Group I have decided to implement this.

I also have used this in the basic example for react-start and
solid-start and added style and style w/loader test cases to both
modules.

---------

Co-authored-by: Flo <fpellet@ensc.fr>
2025-07-02 00:28:12 +02:00
Naoya Shimizu(Shimmy)
980159ae10
refactor(history): use TSR_key namespace in state for hash (#4356)
Co-authored-by: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-06-23 14:48:54 +12:00
Jan Vollmer
785681fa05
fix(router-core): resolve with basepath if to is not supplied (#4472)
Co-authored-by: Sean Cassiere <33615041+SeanCassiere@users.noreply.github.com>
2025-06-23 11:23:57 +12:00