@tanstack/router-core 1.139.12 → 1.139.14

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.
@@ -332,7 +332,13 @@ function parseSegments<TRouteLike extends RouteLike>(
332
332
  // but if there is *also* a layout route at this path, save it as notFound
333
333
  // we can use it when fuzzy matching to display the NotFound component in the layout route
334
334
  if (!isIndex) node.notFound = route
335
- if (!node.route || (!node.isIndex && isIndex)) node.route = route
335
+ // does the new route take precedence over an existing one?
336
+ // yes if previous is not an index route and new one is an index route
337
+ if (!node.route || (!node.isIndex && isIndex)) {
338
+ node.route = route
339
+ // when replacing, replace all attributes that are route-specific (`fullPath` only at the moment)
340
+ node.fullPath = route.fullPath ?? route.from
341
+ }
336
342
  node.isIndex ||= isIndex
337
343
  }
338
344
  }
package/src/router.ts CHANGED
@@ -1793,11 +1793,25 @@ export class RouterCore<
1793
1793
  )
1794
1794
  if (match) {
1795
1795
  Object.assign(params, match.params) // Copy params, because they're cached
1796
- const { from: _from, ...maskProps } = match.route
1796
+ const {
1797
+ from: _from,
1798
+ params: maskParams,
1799
+ ...maskProps
1800
+ } = match.route
1801
+
1802
+ // If mask has a params function, call it with the matched params as context
1803
+ // Otherwise, use the matched params or the provided params value
1804
+ const nextParams =
1805
+ maskParams === false || maskParams === null
1806
+ ? {}
1807
+ : (maskParams ?? true) === true
1808
+ ? params
1809
+ : Object.assign(params, functionalUpdate(maskParams, params))
1810
+
1797
1811
  maskedDest = {
1798
1812
  from: opts.from,
1799
1813
  ...maskProps,
1800
- params,
1814
+ params: nextParams,
1801
1815
  }
1802
1816
  maskedNext = build(maskedDest)
1803
1817
  }