@tanstack/react-router 1.31.19 → 1.31.21

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/router.ts CHANGED
@@ -877,6 +877,7 @@ export class Router<
877
877
  // due to being stale
878
878
  if (match.status === 'success') {
879
879
  match.meta = route.options.meta?.({
880
+ matches,
880
881
  params: match.params,
881
882
  loaderData: match.loaderData,
882
883
  })
@@ -1721,6 +1722,7 @@ export class Router<
1721
1722
  checkLatest()
1722
1723
 
1723
1724
  const meta = route.options.meta?.({
1725
+ matches,
1724
1726
  params: match.params,
1725
1727
  loaderData,
1726
1728
  })
@@ -2141,7 +2143,7 @@ export class Router<
2141
2143
  const matches = this.matchRoutes(
2142
2144
  this.state.location.pathname,
2143
2145
  this.state.location.search,
2144
- ).map((match) => {
2146
+ ).map((match, i, allMatches) => {
2145
2147
  const dehydratedMatch = dehydratedState.dehydratedMatches.find(
2146
2148
  (d) => d.id === match.id,
2147
2149
  )
@@ -2159,6 +2161,7 @@ export class Router<
2159
2161
  ? {}
2160
2162
  : {
2161
2163
  meta: route.options.meta?.({
2164
+ matches: allMatches,
2162
2165
  params: match.params,
2163
2166
  loaderData: dehydratedMatch.loaderData,
2164
2167
  }),
package/src/utils.ts CHANGED
@@ -138,10 +138,9 @@ export function replaceEqualDeep<T>(prev: any, _next: T): T {
138
138
  for (let i = 0; i < nextSize; i++) {
139
139
  const key = array ? i : nextItems[i]
140
140
  if (
141
- !array &&
141
+ ((!array && prevItems.includes(key)) || array) &&
142
142
  prev[key] === undefined &&
143
- next[key] === undefined &&
144
- prevItems.includes(key)
143
+ next[key] === undefined
145
144
  ) {
146
145
  copy[key] = undefined
147
146
  equalItems++