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

295 commits

Author SHA1 Message Date
Sheraff
b51a2d60ab
fix(router-core): avoid per-location url accessor overhead 2026-03-22 19:36:41 +01:00
Flo
c9e18555f3
fix: strip invariant and warning strings from prod bundles (#7007) 2026-03-22 10:27:08 +01:00
Flo
054523900b
refactor: signal based reactivity (#6704) 2026-03-20 10:33:28 +01:00
Manuel Schiller
32fcba7b04
fix: Fix retained promise refs (#6929) 2026-03-16 00:00:40 +01:00
Birk Skyum
ef9b241f3c
build: update to @tanstack/vite-config v0.4.3 (#6923)
* move to vite-config 0.4.3

* changeset

* fix typo in the changeset

* patch vite-config to use module: 100

* Update patch file

* Fix lockfile

---------

Co-authored-by: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com>
2026-03-16 02:27:24 +11:00
Manuel Schiller
6f297a2494
feat: add staleReloadMode (#6921)
* feat: add staleReloadMode

* update

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-03-14 08:41:38 +01:00
Flo
dadf7e9d9d
fix(router-core): null prototype input/output objects (#6882) 2026-03-10 20:22:35 +01:00
Manuel Schiller
b7def82c7d
fix: ensure lazy error component is preloaded (#6875) 2026-03-09 23:04:09 +01:00
Manuel Schiller
31ed0a9648
fix: don't re-execute stale loaders on unrelated location changes (#6867)
* fix: don't re-execute stale loaders on unrelated location changes

* lint

* remove loaderKeyChanged

* from last

* inline staleMatchShouldReload

* update tests

* add test

* fix

* revert
2026-03-09 20:02:35 +01:00
Manuel Schiller
9c81d5ac57
fix: handle beforeLoad throwing notFound correctly (#6811) 2026-03-04 21:34:28 +01:00
Dmitrii
442ada1f64
fix(router-core): use routeId for lifecycle hooks to fix onStay when loaderDeps change (#6769) 2026-02-27 22:53:20 +01:00
Flo
6b42138998
fix(router-core): tanstack/store v0.9 requires createStore instead of new Store (#6759)
Co-authored-by: Sheraff <florian.pellet@ensc.fr>
2026-02-25 09:23:42 +01:00
Flo
f58d457542
fix(react-router,solid-router,vue-router): correct preload triggers for "intent" option (#6747) 2026-02-24 13:48:43 +01:00
Flo
343f8a8ff9
refactor(router-core,react-router,solid-router,vue-router): Remove long strings from production bundle (#6740) 2026-02-23 17:23:46 +01:00
Flo
14b5499dbc
fix(router-core): dehydrate SSR match IDs with non-path encoding (#6742) 2026-02-23 17:12:40 +01:00
Manuel Schiller
d6af3a28c3
chore: cleanup unused exports (#6735) 2026-02-23 00:19:06 +01:00
Flo
63e9e71991
refactor(router-core): remove unnecessary interpolatePath() in buildLocation (#6721) 2026-02-22 09:28:25 +01:00
Manuel Schiller
fdb8d2e604
fix(router-core): don't set isServer if NODE_ENV test (#6727)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-21 22:47:06 +01:00
Abhisar Mehta
608007acdf
fix(router): catch stringifyParams errors and render errorComponent (#6718) 2026-02-21 12:06:18 +01:00
Ulrich Stark
ad0beaf95b
chore: remove unnecessary type assertions (#6365)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-21 11:29:18 +01:00
JongKyung Lee
33f253eaff
docs: clarify that location hash excludes the leading # (#6707) 2026-02-20 01:05:54 +01:00
Flo
c3ad063785
chore: migrate to @tanstack/store 0.9.1 (#6691) 2026-02-19 22:26:59 +01:00
Flo
99e3025650
fix(react-router): keep relative link active when changing inherited param (#6689) 2026-02-18 09:56:01 +01:00
Flo
6ddb5867cc
feat(router-core, react-router, solid-router, vue-router): isDangerousProtocol uses customizable allowlist (#6542) 2026-02-15 08:04:28 +01:00
Manuel Schiller
2148b1bb4d
fix: resolve pending state when throwing notFound in beforeLoad (#6654)
fixes #6021
2026-02-14 01:44:53 +01:00
Manuel Schiller
85b34a799f
fix: don't cache server side route tree during dev (#6650)
fixes #6556
fixes #6559
fixes #6640
2026-02-13 19:34:06 +01:00
Lee Jong Kyung
5c923e45c3
fix(router): ensure useParams returns parsed params when strict is false (#6387)
* fix: optimize match retrieval by using a Map for previous matches

* feat: add strict false parameter handling and related routes

* replace params only when routeParams is fully parsed

---------

Co-authored-by: Nico Lynzaad <nlynzaad@zylangroup.com>
Co-authored-by: Nico Lynzaad <44094871+nlynzaad@users.noreply.github.com>
2026-02-09 02:44:30 +02:00
Nico Lynzaad
40ed6832c6
fix(start-server-core): redirect misinterpreted protocol-relative URLs (#6600)
* add test to verify redirect

* handle redirect

* update tests

* cleanup unused code in decodePath

* use 308 instead of 302

* redirect is not relevant in spa mode
2026-02-07 02:00:19 +02:00
Lee
28b0e8b244
fix(router-core): fix handle AbortError logic when rapid navigation (#6426)
* fix(router-core): fix handle AbortError logic

Signed-off-by: leesb971204 <leesb971204@gmail.com>

* ci: apply automated fixes

* test: update expected store update count for preloaded async loaders

Signed-off-by: leesb971204 <leesb971204@gmail.com>

* refractor changes

* update tests to handle wait times more appropriately

* tighten up test - coderabbit nitpick

---------

Signed-off-by: leesb971204 <leesb971204@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Nico Lynzaad <nlynzaad@zylangroup.com>
2026-02-05 03:38:09 +02:00
Manuel Schiller
a894baa7bd
feat: pass routeId into context/beforeLoad (#6579)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-03 00:59:12 +01:00
Manuel Schiller
ebd96af435
fix: avoid destructuring internal server property in interpolatePath (#6580) 2026-02-03 00:53:03 +01:00
Flo
1ce1919c4b
refactor(router-core): matchRoutesInternal minor performance improvements (#6560) 2026-01-31 16:39:50 +01:00
Jason Xie
4814d4ef90
fix(router-core): use encodeURIComponent for splat route params (#6520)
* fix(router-core): use encodeURIComponent for splat route params

Use encodeURIComponent instead of encodeURI for splat route parameters
to properly encode spaces, plus signs, and other special characters.

This fixes an SSR redirect loop that occurs when:
1. User navigates to a splat route with encoded characters (e.g., %20)
2. TanStack Router decodes params with decodeURIComponent
3. When rebuilding URL, encodeURI doesn't encode spaces/special chars
4. URL mismatch triggers redirect loop (307 redirects)

encodeURIComponent properly encodes these characters, preventing the
mismatch while still preserving forward slashes as path separators.

* update tests to use correct encoding for splat params

* use encodePathParam for splat/catch-all

* perf(router-core): add early return for URL-safe splat values

Add performance optimization that skips the split/map/join operation
when splat values only contain URL-safe characters (alphanumeric,
dash, period, underscore, tilde, exclamation, forward slash).

This avoids unnecessary processing in the hot path for common cases.

* fix(router-core): encode whitespace in encodeNonAscii

Update encodeNonAscii to also encode whitespace characters (spaces, tabs, etc.)
in addition to non-ASCII characters. This fixes SSR redirect loops where:

1. Request URL contains encoded spaces: /path/file%20name.pdf
2. parseLocation decodes pathname: /path/file name.pdf
3. buildLocation calls encodeNonAscii but spaces weren't encoded
4. URL mismatch triggers redirect loop

Now encodeNonAscii properly encodes:
- Whitespace characters (spaces become %20)
- Non-ASCII/unicode characters (including emojis)

Other ASCII special characters (parentheses, brackets, etc.) are preserved
as they are valid in URL paths.

* refactor(router-core): use regex in encodeNonAscii like original

* refactor(router-core): rename encodeNonAscii to encodePathLikeUrl

Rename the function to better reflect its expanded responsibility of
encoding paths the same way new URL() would, including:
- Whitespace characters (spaces → %20, tabs → %09)
- Non-ASCII/Unicode characters (emojis, accented characters)

The old name 'encodeNonAscii' was misleading since the function now
encodes more than just non-ASCII characters.

---------

Co-authored-by: Nico Lynzaad <nlynzaad@zylangroup.com>
Co-authored-by: Nico Lynzaad <44094871+nlynzaad@users.noreply.github.com>
2026-01-26 23:53:20 +02:00
Flo
46630344d7
refactor(router-core): parseLocation fast path w/ no rewrites (#6516) 2026-01-26 07:36:11 +01:00
Flo
02019f1164
refactor(router-core): executeBeforeLoad remove dead code (#6517) 2026-01-25 23:03:20 +01:00
Flo
e2558a3007
refactor(router-core): startViewTransition performance improved by avoiding 'delete' (#6515) 2026-01-25 22:09:05 +01:00
Flo
283598e311
refactor(router-core): mergeHeaders performance (#6514) 2026-01-25 21:48:11 +01:00
Flo
54649f9d3e
refactor(router-core): throw redirect w/ a pre-build location doesn't need to re-parse from string (#6512) 2026-01-25 19:53:22 +01:00
Flo
fc38d91997
refactor(router-core): remove dead code in buildLocation left over from reverting match snapshots (#6510) 2026-01-25 19:08:25 +01:00
Flo
ab92e1c290
refactor(router-core): buildLocation can skip second interpolatePath if no params.parse function in the branch (#6506) 2026-01-25 16:10:00 +01:00
Flo
b90726dcc8
refactor(router-core): server-only fast path optimization for interpolatePath (#6505) 2026-01-25 14:48:02 +01:00
Flo
036b3b1d70
refactor(router-core): decodePath fast path when no encoded chars (#6504) 2026-01-25 12:04:06 +01:00
Flo
84553e9298
refactor(router-core): improve server store performance by removing getter/setter (#6502) 2026-01-25 10:19:05 +01:00
Manuel Schiller
8f525a80a6
performance: no reactivity on the server (#6497)
* performance: don't use `replaceEqualDeep` on the server

* performance: do not subscribe to store on the server

* lint

* simple store on the server

* vue + solid
2026-01-25 02:34:39 +01:00
Manuel Schiller
ba47d4db6e
refactor: streaming perf (#6496) 2026-01-24 23:33:20 +01:00
Manuel Schiller
44fbe0a46e
fix: streaming race condition (#6495) 2026-01-24 21:43:50 +01:00
Manuel Schiller
0fc75f29e4
fix: re-export correctly (#6489)
* fix: re-export correctly

* fix

* fix

* lint
2026-01-24 17:55:28 +01:00
Manuel Schiller
b953e000fb
refactor: no additional package for isServer (#6485)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-01-24 12:54:18 +01:00
Flo
cfbbcd556c
refactor(router-core): skip URL constructor in buildLocation (#6447) 2026-01-24 11:42:55 +01:00
Manuel Schiller
e79ad7e052
feat: add isServer (#4648)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-01-24 11:28:54 +01:00