@tanstack/react-router 1.51.6 → 1.51.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
- "version": "1.51.6",
3
+ "version": "1.51.8",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -52,7 +52,7 @@
52
52
  "@tanstack/react-store": "^0.5.5",
53
53
  "tiny-invariant": "^1.3.3",
54
54
  "tiny-warning": "^1.0.3",
55
- "@tanstack/history": "1.51.6"
55
+ "@tanstack/history": "1.51.7"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@testing-library/jest-dom": "^6.4.8",
package/src/Matches.tsx CHANGED
@@ -4,14 +4,10 @@ import { CatchBoundary, ErrorComponent } from './CatchBoundary'
4
4
  import { useRouterState } from './useRouterState'
5
5
  import { useRouter } from './useRouter'
6
6
  import { Transitioner } from './Transitioner'
7
- import {
8
- type AnyRoute,
9
- type ReactNode,
10
- type StaticDataRouteOption,
11
- } from './route'
12
7
  import { matchContext } from './matchContext'
13
8
  import { Match } from './Match'
14
9
  import { SafeFragment } from './SafeFragment'
10
+ import type { AnyRoute, ReactNode, StaticDataRouteOption } from './route'
15
11
  import type { AnyRouter, RegisteredRouter } from './router'
16
12
  import type { ResolveRelativePath, ToOptions } from './link'
17
13
  import type {
package/src/qss.ts CHANGED
@@ -68,6 +68,7 @@ export function decode(str: any, pfx?: string) {
68
68
  const equalIndex = tmp.indexOf('=')
69
69
  if (equalIndex !== -1) {
70
70
  k = tmp.slice(0, equalIndex)
71
+ k = decodeURIComponent(k)
71
72
  const value = tmp.slice(equalIndex + 1)
72
73
  if (out[k] !== void 0) {
73
74
  // @ts-expect-error
@@ -77,6 +78,7 @@ export function decode(str: any, pfx?: string) {
77
78
  }
78
79
  } else {
79
80
  k = tmp
81
+ k = decodeURIComponent(k)
80
82
  out[k] = ''
81
83
  }
82
84
  }
package/src/router.ts CHANGED
@@ -492,7 +492,6 @@ export interface BuildNextOptions {
492
492
  unmaskOnReload?: boolean
493
493
  }
494
494
  from?: string
495
- fromSearch?: unknown
496
495
  _fromLocation?: ParsedLocation
497
496
  }
498
497
 
@@ -1304,13 +1303,9 @@ export class Router<
1304
1303
  } = {},
1305
1304
  matches?: Array<MakeRouteMatch<TRouteTree>>,
1306
1305
  ): ParsedLocation => {
1307
- const fromMatches =
1308
- dest._fromLocation != null
1309
- ? this.matchRoutes({
1310
- ...dest._fromLocation,
1311
- search: dest.fromSearch || dest._fromLocation.search,
1312
- })
1313
- : this.state.matches
1306
+ const fromMatches = dest._fromLocation
1307
+ ? this.matchRoutes(dest._fromLocation)
1308
+ : this.state.matches
1314
1309
 
1315
1310
  const fromMatch =
1316
1311
  dest.from != null
@@ -1330,7 +1325,9 @@ export class Router<
1330
1325
  'Could not find match for from: ' + dest.from,
1331
1326
  )
1332
1327
 
1333
- const fromSearch = last(fromMatches)?.search || this.latestLocation.search
1328
+ const fromSearch = this.state.pendingMatches
1329
+ ? last(this.state.pendingMatches)?.search
1330
+ : last(fromMatches)?.search || this.latestLocation.search
1334
1331
 
1335
1332
  const stayingMatches = matches?.filter((d) =>
1336
1333
  fromMatches.find((e) => e.routeId === d.routeId),