@tanstack/router-core 1.131.23 → 1.131.24

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.
@@ -229,7 +229,7 @@ class RouterCore {
229
229
  };
230
230
  this.buildLocation = (opts) => {
231
231
  const build = (dest = {}) => {
232
- var _a;
232
+ var _a, _b;
233
233
  const currentLocation = dest._fromLocation || this.latestLocation;
234
234
  const allCurrentLocationMatches = this.matchRoutes(currentLocation, {
235
235
  _buildLocation: true
@@ -262,51 +262,51 @@ class RouterCore {
262
262
  const fromSearch = lastMatch.search;
263
263
  const fromParams = { ...lastMatch.params };
264
264
  const nextTo = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");
265
- let nextParams = dest.params === false || dest.params === null ? {} : (dest.params ?? true) === true ? fromParams : {
266
- ...fromParams,
267
- ...functionalUpdate(dest.params, fromParams)
268
- };
265
+ const nextParams = dest.params === false || dest.params === null ? {} : (dest.params ?? true) === true ? fromParams : Object.assign(
266
+ fromParams,
267
+ functionalUpdate(dest.params, fromParams)
268
+ );
269
269
  const interpolatedNextTo = interpolatePath({
270
270
  path: nextTo,
271
- params: nextParams ?? {},
271
+ params: nextParams,
272
272
  parseCache: this.parsePathnameCache
273
273
  }).interpolatedPath;
274
274
  const destRoutes = this.matchRoutes(interpolatedNextTo, void 0, {
275
275
  _buildLocation: true
276
276
  }).map((d) => this.looseRoutesById[d.routeId]);
277
277
  if (Object.keys(nextParams).length > 0) {
278
- destRoutes.map((route) => {
279
- var _a2;
280
- return ((_a2 = route.options.params) == null ? void 0 : _a2.stringify) ?? route.options.stringifyParams;
281
- }).filter(Boolean).forEach((fn) => {
282
- nextParams = { ...nextParams, ...fn(nextParams) };
283
- });
278
+ for (const route of destRoutes) {
279
+ const fn = ((_a = route.options.params) == null ? void 0 : _a.stringify) ?? route.options.stringifyParams;
280
+ if (fn) {
281
+ Object.assign(nextParams, fn(nextParams));
282
+ }
283
+ }
284
284
  }
285
285
  const nextPathname = interpolatePath({
286
286
  // Use the original template path for interpolation
287
287
  // This preserves the original parameter syntax including optional parameters
288
288
  path: nextTo,
289
- params: nextParams ?? {},
289
+ params: nextParams,
290
290
  leaveWildcards: false,
291
291
  leaveParams: opts.leaveParams,
292
292
  decodeCharMap: this.pathParamsDecodeCharMap,
293
293
  parseCache: this.parsePathnameCache
294
294
  }).interpolatedPath;
295
295
  let nextSearch = fromSearch;
296
- if (opts._includeValidateSearch && ((_a = this.options.search) == null ? void 0 : _a.strict)) {
297
- let validatedSearch = {};
296
+ if (opts._includeValidateSearch && ((_b = this.options.search) == null ? void 0 : _b.strict)) {
297
+ const validatedSearch = {};
298
298
  destRoutes.forEach((route) => {
299
- try {
300
- if (route.options.validateSearch) {
301
- validatedSearch = {
302
- ...validatedSearch,
303
- ...validateSearch(route.options.validateSearch, {
299
+ if (route.options.validateSearch) {
300
+ try {
301
+ Object.assign(
302
+ validatedSearch,
303
+ validateSearch(route.options.validateSearch, {
304
304
  ...validatedSearch,
305
305
  ...nextSearch
306
- }) ?? {}
307
- };
306
+ })
307
+ );
308
+ } catch {
308
309
  }
309
- } catch {
310
310
  }
311
311
  });
312
312
  nextSearch = validatedSearch;