@tanstack/router-core 1.139.12 → 1.139.13

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
@@ -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
  }