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

1,810 commits

Author SHA1 Message Date
Tanner Linsley
840d2802b0 release: v1.132.0-alpha.8 2025-08-28 22:53:41 +00:00
chorobin
581f1e56a6 tests and examples fixed 2025-08-28 23:07:23 +02:00
chorobin
568c485ef0 tests and linting 2025-08-28 00:15:27 +02:00
chorobin
c145e397d8 serialization pls 2025-08-28 00:02:09 +02:00
Nico Lynzaad
d56aa42a8a Merge branch 'relative-routing-to-current-location' into alpha 2025-08-26 23:45:03 +02:00
Tanner Linsley
7c40453eeb Revert "Revert "fix: do not pre-decodeURI before passing to createMemoryHistory (#4893)""
This reverts commit af0cd986c2.
2025-08-26 10:45:57 -06:00
Nico Lynzaad
508ee37b27 Merge branch 'main' into relative-routing-to-current-location 2025-08-26 17:19:58 +02:00
chorobin
b54d056109 "serialization rulez" second attempt 2025-08-24 23:24:19 +02:00
chorobin
9a4efc61ec "serialization rulez" 2025-08-24 23:00:07 +02:00
Flo
9cc216b41c
test(react-router): add more variants to store-updates test (#5019)
Add a few more setup configurations to measure the number of `__store`
updates:
- with caching (`staleTime > 0`)
- when preloading multiple times the same route (simulates hovering a
list of links to the same page w/ different params)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-08-23 16:26:36 +02:00
Tanner Linsley
517ab4aa38 release: v1.132.0-alpha.4 2025-08-22 04:11:45 +00:00
Manuel Schiller
a1f37a8589 allow dynamic scrollRestoration config 2025-08-21 20:11:28 +02:00
Manuel Schiller
22ad997f1e fix ScriptOnce to cleanup after itself 2025-08-21 20:07:35 +02:00
Manuel Schiller
c3258bfbae fix: scroll restoration on the server 2025-08-21 20:07:35 +02:00
Tanner Linsley
6524f53e3c release: v1.132.0-alpha.3 2025-08-20 17:10:11 +00:00
Manuel Schiller
7f0cc200a6 Merge remote-tracking branch 'origin/custom-transformers' into HEAD 2025-08-20 19:04:46 +02:00
Manuel Schiller
1ab8d26826 Merge remote-tracking branch 'origin/main' into HEAD 2025-08-20 18:32:40 +02:00
Nico Lynzaad
3e664620d6 resolve test failure 2025-08-20 01:42:00 +02:00
autofix-ci[bot]
9c4606045b
ci: apply automated fixes 2025-08-19 23:01:27 +00:00
Nico Lynzaad
29dfcf9b6e refactor based on coderabbit recommendations 2025-08-20 01:00:28 +02:00
autofix-ci[bot]
3d93911259
ci: apply automated fixes 2025-08-19 20:18:46 +00:00
Nico Lynzaad
ab6f27b83b rersolve inconsistency between solid and react implementation 2025-08-19 22:16:41 +02:00
Nico Lynzaad
41481f760a Merge branch 'main' into relative-routing-to-current-location 2025-08-19 12:39:04 +02:00
Flo
3f05c0b16b
test(router-core): fix flakiness of store-updates 'preload then navigate' test (#4995)
It turns out the 'hover preload, then navigate, w/ async loaders' test
in
`packages/react-router/tests/store-updates-during-navigation.test.tsx`
was sometimes (but very rarely) yielding 16 updates instead of the
expected 15. This PR makes minimal changes to this test so that it's now
reliably 14.

I'm not exactly sure where we lost that 1 update, so we might not be
measuring exactly the same thing. But it's still worth it to have a
robust test suite.

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

## Summary by CodeRabbit

* **Tests**
* Improved reliability of hover preloading and navigation behavior tests
by introducing realistic loader delays and aligning interaction timing,
reducing flakiness.
* Updated assertions for store updates during navigation to reflect
observed behavior, ensuring more stable and predictable test outcomes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-08-19 09:18:47 +02:00
Tanner Linsley
83ab17331b release: v1.131.27 2025-08-19 06:53:58 +00: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
autofix-ci[bot]
452f876729
ci: apply automated fixes 2025-08-19 03:32:37 +00:00
Nico Lynzaad
d3391ea501 Merge branch 'main' into relative-routing-to-current-location 2025-08-19 03:37:00 +02:00
Nico Lynzaad
de884b8e97 consolidate from logic 2025-08-19 03:34:31 +02:00
Nico Lynzaad
8f41f218f5 cleanup tests 2025-08-19 00:12:47 +02:00
Manuel Schiller
43c01fb9d2 rename 2025-08-18 19:37:35 +02:00
Tanner Linsley
f2190d77ba release: v1.131.26 2025-08-18 07:56:53 +00:00
Manuel Schiller
a75e1913bf custom transformers 2025-08-18 00:52:23 +02:00
autofix-ci[bot]
ad7eea5006
ci: apply automated fixes 2025-08-17 22:12:12 +00:00
Nico Lynzaad
0ae150e41e reactivity and code cleanup 2025-08-18 00:10:32 +02:00
autofix-ci[bot]
723540c4c1
ci: apply automated fixes 2025-08-17 20:12:41 +00:00
Nico Lynzaad
983b7cee5c Merge branch 'main' into relative-routing-to-current-location 2025-08-17 22:10:55 +02:00
Nico Lynzaad
0c9b67a0fb apply code rabbit suggestions 2025-08-17 22:06:44 +02:00
Tanner Linsley
fa3f8faf45 release: v1.131.25 2025-08-17 19:27:38 +00: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
Nico Lynzaad
d5701da026 Merge branch 'main' into relative-routing-to-current-location
# Conflicts:
#	packages/router-core/src/router.ts
2025-08-17 21:16:53 +02:00
Tanner Linsley
472cac4ae4 release: v1.131.24 2025-08-17 16:43:55 +00: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
Tanner Linsley
b953a37860 release: v1.131.23 2025-08-17 16:32:35 +00:00
Flo
9437fee5c7
refactor(router-core,react-router,solid-router): avoid copying arrays just to .reverse() them (#4980)
The pattern of copying an array just to `.reverse()` it and iterate it
from the end ends up creating a transient object (a copy of the array)
that needs to be garbage collected.

For example:
```ts
[...array].reverse().find(() => {/*...*/})
```
or
```ts
[...array].reverse().forEach(() => {/*...*/})
```

Instead we can use a regular `for` loop to iterate it from the end. This
will be mostly beneficial in `router-core > router > buildLocation` that
gets called pretty often.

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

- **Refactor**
- Improved head metadata processing in React and Solid routers to be
more efficient and readable, reducing work for large route metadata
sets.
- Simplified route matching logic to consistently pick the last relevant
match, improving clarity and maintainability.

- **Chores**
- Added a utility to locate the last list item meeting a condition,
supporting cleaner routing internals.
<!-- 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:30:59 +02:00
autofix-ci[bot]
44ad37c868
ci: apply automated fixes 2025-08-17 13:50:59 +00:00
Nico Lynzaad
ba524f121c test cleanup 2025-08-17 14:27:36 +02:00
Nico Lynzaad
55ba9afd9d code cleanup 2025-08-17 14:22:02 +02:00
Nico Lynzaad
9e1b1dd47b some more test refining 2025-08-17 14:06:19 +02:00
Nico Lynzaad
c53266f8f6 update react-router tests 2025-08-17 03:31:02 +02:00