@tanstack/react-router 1.168.14 → 1.168.16

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/src/Match.tsx CHANGED
@@ -30,7 +30,7 @@ export const Match = React.memo(function MatchImpl({
30
30
  const router = useRouter()
31
31
 
32
32
  if (isServer ?? router.isServer) {
33
- const match = router.stores.activeMatchStoresById.get(matchId)?.get()
33
+ const match = router.stores.matchStores.get(matchId)?.get()
34
34
  if (!match) {
35
35
  if (process.env.NODE_ENV !== 'production') {
36
36
  throw new Error(
@@ -64,7 +64,7 @@ export const Match = React.memo(function MatchImpl({
64
64
  // The matchId prop is stable for this component's lifetime (set by Outlet),
65
65
  // and reconcileMatchPool reuses stores for the same matchId.
66
66
 
67
- const matchStore = router.stores.activeMatchStoresById.get(matchId)
67
+ const matchStore = router.stores.matchStores.get(matchId)
68
68
  if (!matchStore) {
69
69
  if (process.env.NODE_ENV !== 'production') {
70
70
  throw new Error(
@@ -278,7 +278,7 @@ export const MatchInner = React.memo(function MatchInnerImpl({
278
278
  }
279
279
 
280
280
  if (isServer ?? router.isServer) {
281
- const match = router.stores.activeMatchStoresById.get(matchId)?.get()
281
+ const match = router.stores.matchStores.get(matchId)?.get()
282
282
  if (!match) {
283
283
  if (process.env.NODE_ENV !== 'production') {
284
284
  throw new Error(
@@ -357,7 +357,7 @@ export const MatchInner = React.memo(function MatchInnerImpl({
357
357
  return out
358
358
  }
359
359
 
360
- const matchStore = router.stores.activeMatchStoresById.get(matchId)
360
+ const matchStore = router.stores.matchStores.get(matchId)
361
361
  if (!matchStore) {
362
362
  if (process.env.NODE_ENV !== 'production') {
363
363
  throw new Error(
@@ -504,7 +504,7 @@ export const Outlet = React.memo(function OutletImpl() {
504
504
  let childMatchId: string | undefined
505
505
 
506
506
  if (isServer ?? router.isServer) {
507
- const matches = router.stores.activeMatchesSnapshot.get()
507
+ const matches = router.stores.matches.get()
508
508
  const parentIndex = matchId
509
509
  ? matches.findIndex((match) => match.id === matchId)
510
510
  : -1
@@ -517,7 +517,7 @@ export const Outlet = React.memo(function OutletImpl() {
517
517
  // Subscribe directly to the match store from the pool instead of
518
518
  // the two-level byId → matchStore pattern.
519
519
  const parentMatchStore = matchId
520
- ? router.stores.activeMatchStoresById.get(matchId)
520
+ ? router.stores.matchStores.get(matchId)
521
521
  : undefined
522
522
 
523
523
  // eslint-disable-next-line react-hooks/rules-of-hooks
package/src/Matches.tsx CHANGED
@@ -77,9 +77,9 @@ function MatchesInner() {
77
77
  const router = useRouter()
78
78
  const _isServer = isServer ?? router.isServer
79
79
  const matchId = _isServer
80
- ? router.stores.firstMatchId.get()
80
+ ? router.stores.firstId.get()
81
81
  : // eslint-disable-next-line react-hooks/rules-of-hooks
82
- useStore(router.stores.firstMatchId, (id) => id)
82
+ useStore(router.stores.firstId, (id) => id)
83
83
  const resetKey = _isServer
84
84
  ? router.stores.loadedAt.get()
85
85
  : // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -142,7 +142,7 @@ export function useMatchRoute<TRouter extends AnyRouter = RegisteredRouter>() {
142
142
 
143
143
  if (!(isServer ?? router.isServer)) {
144
144
  // eslint-disable-next-line react-hooks/rules-of-hooks
145
- useStore(router.stores.matchRouteReactivity, (d) => d)
145
+ useStore(router.stores.matchRouteDeps, (d) => d)
146
146
  }
147
147
 
148
148
  return React.useCallback(
@@ -240,7 +240,7 @@ export function useMatches<
240
240
  )
241
241
 
242
242
  if (isServer ?? router.isServer) {
243
- const matches = router.stores.activeMatchesSnapshot.get() as Array<
243
+ const matches = router.stores.matches.get() as Array<
244
244
  MakeRouteMatchUnion<TRouter>
245
245
  >
246
246
  return (opts?.select ? opts.select(matches) : matches) as UseMatchesResult<
@@ -250,7 +250,7 @@ export function useMatches<
250
250
  }
251
251
 
252
252
  // eslint-disable-next-line react-hooks/rules-of-hooks
253
- return useStore(router.stores.activeMatchesSnapshot, (matches) => {
253
+ return useStore(router.stores.matches, (matches) => {
254
254
  const selected = opts?.select
255
255
  ? opts.select(matches as Array<MakeRouteMatchUnion<TRouter>>)
256
256
  : (matches as any)
package/src/Scripts.tsx CHANGED
@@ -58,7 +58,7 @@ export const Scripts = () => {
58
58
  )
59
59
 
60
60
  if (isServer ?? router.isServer) {
61
- const activeMatches = router.stores.activeMatchesSnapshot.get()
61
+ const activeMatches = router.stores.matches.get()
62
62
  const assetScripts = getAssetScripts(activeMatches)
63
63
  const scripts = getScripts(activeMatches)
64
64
  return renderScripts(router, scripts, assetScripts)
@@ -66,16 +66,12 @@ export const Scripts = () => {
66
66
 
67
67
  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static
68
68
  const assetScripts = useStore(
69
- router.stores.activeMatchesSnapshot,
69
+ router.stores.matches,
70
70
  getAssetScripts,
71
71
  deepEqual,
72
72
  )
73
73
  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static
74
- const scripts = useStore(
75
- router.stores.activeMatchesSnapshot,
76
- getScripts,
77
- deepEqual,
78
- )
74
+ const scripts = useStore(router.stores.matches, getScripts, deepEqual)
79
75
 
80
76
  return renderScripts(router, scripts, assetScripts)
81
77
  }
@@ -17,17 +17,14 @@ export function Transitioner() {
17
17
  const [isTransitioning, setIsTransitioning] = React.useState(false)
18
18
  // Track pending state changes
19
19
  const isLoading = useStore(router.stores.isLoading, (value) => value)
20
- const hasPendingMatches = useStore(
21
- router.stores.hasPendingMatches,
22
- (value) => value,
23
- )
20
+ const hasPending = useStore(router.stores.hasPending, (value) => value)
24
21
 
25
22
  const previousIsLoading = usePrevious(isLoading)
26
23
 
27
- const isAnyPending = isLoading || isTransitioning || hasPendingMatches
24
+ const isAnyPending = isLoading || isTransitioning || hasPending
28
25
  const previousIsAnyPending = usePrevious(isAnyPending)
29
26
 
30
- const isPagePending = isLoading || hasPendingMatches
27
+ const isPagePending = isLoading || hasPending
31
28
  const previousIsPagePending = usePrevious(isPagePending)
32
29
 
33
30
  router.startTransition = (fn: () => void) => {
@@ -194,14 +194,14 @@ export const useTags = (assetCrossOrigin?: AssetCrossOriginConfig) => {
194
194
  return buildTagsFromMatches(
195
195
  router,
196
196
  nonce,
197
- router.stores.activeMatchesSnapshot.get(),
197
+ router.stores.matches.get(),
198
198
  assetCrossOrigin,
199
199
  )
200
200
  }
201
201
 
202
202
  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static
203
203
  const routeMeta = useStore(
204
- router.stores.activeMatchesSnapshot,
204
+ router.stores.matches,
205
205
  (matches) => {
206
206
  return matches.map((match) => match.meta!).filter(Boolean)
207
207
  },
@@ -282,7 +282,7 @@ export const useTags = (assetCrossOrigin?: AssetCrossOriginConfig) => {
282
282
 
283
283
  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static
284
284
  const links = useStore(
285
- router.stores.activeMatchesSnapshot,
285
+ router.stores.matches,
286
286
  (matches) => {
287
287
  const constructed = matches
288
288
  .map((match) => match.links!)
@@ -327,7 +327,7 @@ export const useTags = (assetCrossOrigin?: AssetCrossOriginConfig) => {
327
327
 
328
328
  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static
329
329
  const preloadLinks = useStore(
330
- router.stores.activeMatchesSnapshot,
330
+ router.stores.matches,
331
331
  (matches) => {
332
332
  const preloadLinks: Array<RouterManagedTag> = []
333
333
 
@@ -359,7 +359,7 @@ export const useTags = (assetCrossOrigin?: AssetCrossOriginConfig) => {
359
359
 
360
360
  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static
361
361
  const styles = useStore(
362
- router.stores.activeMatchesSnapshot,
362
+ router.stores.matches,
363
363
  (matches) =>
364
364
  (
365
365
  matches
@@ -379,7 +379,7 @@ export const useTags = (assetCrossOrigin?: AssetCrossOriginConfig) => {
379
379
 
380
380
  // eslint-disable-next-line react-hooks/rules-of-hooks -- condition is static
381
381
  const headScripts: Array<RouterManagedTag> = useStore(
382
- router.stores.activeMatchesSnapshot,
382
+ router.stores.matches,
383
383
  (matches) =>
384
384
  (
385
385
  matches
package/src/index.tsx CHANGED
@@ -73,6 +73,7 @@ export type {
73
73
  ResolveRouteContext,
74
74
  SearchSerializer,
75
75
  SearchParser,
76
+ SearchMiddleware,
76
77
  TrailingSlashOption,
77
78
  Manifest,
78
79
  RouterManagedTag,
package/src/useMatch.tsx CHANGED
@@ -113,8 +113,8 @@ export function useMatch<
113
113
  const key = opts.from ?? nearestMatchId
114
114
  const matchStore = key
115
115
  ? opts.from
116
- ? router.stores.getMatchStoreByRouteId(key)
117
- : router.stores.activeMatchStoresById.get(key)
116
+ ? router.stores.getRouteMatchStore(key)
117
+ : router.stores.matchStores.get(key)
118
118
  : undefined
119
119
 
120
120
  if (isServer ?? router.isServer) {