@tanstack/router-core 0.0.1-alpha.5 → 0.0.1-alpha.6

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-alpha.5",
4
+ "version": "0.0.1-alpha.6",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router",
package/src/index.ts CHANGED
@@ -1410,8 +1410,6 @@ export function createRouter<
1410
1410
  router.startedLoadingAt = id
1411
1411
 
1412
1412
  if (next) {
1413
- // If the location.href has changed
1414
-
1415
1413
  // Ingest the new location
1416
1414
  router.location = next
1417
1415
  }
@@ -1708,7 +1706,7 @@ export function createRouter<
1708
1706
  ...(router.state.pending?.matches ?? []),
1709
1707
  ].forEach((match) => {
1710
1708
  if (unloadedMatchIds.includes(match.matchId)) {
1711
- match.isInvalid = true
1709
+ match.invalidate()
1712
1710
  }
1713
1711
  })
1714
1712
  },
@@ -1757,7 +1755,7 @@ export function createRouter<
1757
1755
  return router.commitLocation(next, location.replace)
1758
1756
  },
1759
1757
 
1760
- navigate: async ({ from, to = '.', search, hash, replace }) => {
1758
+ navigate: async ({ from, to = '.', search, hash, replace, params }) => {
1761
1759
  // If this link simply reloads the current route,
1762
1760
  // make sure it has a new key so it will trigger a data refresh
1763
1761
 
@@ -1783,6 +1781,8 @@ export function createRouter<
1783
1781
  to: toString,
1784
1782
  search,
1785
1783
  hash,
1784
+ replace,
1785
+ params,
1786
1786
  })
1787
1787
  },
1788
1788
 
@@ -2319,7 +2319,9 @@ type SearchParamOptions<
2319
2319
  search: SearchReducer<TFromSchema, TToSchema>
2320
2320
  }
2321
2321
 
2322
- type SearchReducer<TFrom, TTo> = TTo | ((current: TFrom) => TTo)
2322
+ type SearchReducer<TFrom, TTo> =
2323
+ | { [TKey in keyof TTo]: TTo[TKey] }
2324
+ | ((current: TFrom) => TTo)
2323
2325
 
2324
2326
  type PathParamOptions<
2325
2327
  TAllRouteInfo extends AnyAllRouteInfo,
@@ -2395,6 +2397,7 @@ export interface RouteMatch<
2395
2397
  }
2396
2398
  cancel: () => void
2397
2399
  load: () => Promise<void>
2400
+ invalidate: () => void
2398
2401
  }
2399
2402
 
2400
2403
  export function createRouteMatch<
@@ -2514,6 +2517,9 @@ export function createRouteMatch<
2514
2517
  routeMatch.__.abortController?.abort()
2515
2518
  routeMatch.__.cancelPending()
2516
2519
  },
2520
+ invalidate: () => {
2521
+ routeMatch.isInvalid = true
2522
+ },
2517
2523
  load: async () => {
2518
2524
  const id = '' + Date.now() + Math.random()
2519
2525
  routeMatch.__.latestId = id