@tanstack/router-core 1.157.8 → 1.157.10

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.
@@ -335,25 +335,21 @@ class RouterCore {
335
335
  const interpolatedNextTo = path.interpolatePath({
336
336
  path: nextTo,
337
337
  params: nextParams,
338
+ decoder: this.pathParamsDecoder,
338
339
  server: this.isServer
339
340
  }).interpolatedPath;
340
341
  const destMatchResult = this.getMatchedRoutes(interpolatedNextTo);
341
342
  let destRoutes = destMatchResult.matchedRoutes;
342
343
  const isGlobalNotFound = destMatchResult.foundRoute ? destMatchResult.foundRoute.path !== "/" && destMatchResult.routeParams["**"] : path.trimPathRight(interpolatedNextTo);
343
- if (isGlobalNotFound) {
344
- if (this.options.notFoundRoute) {
345
- destRoutes = [...destRoutes, this.options.notFoundRoute];
346
- } else {
347
- findGlobalNotFoundRouteId(
348
- this.options.notFoundMode,
349
- destRoutes
350
- );
351
- }
344
+ if (isGlobalNotFound && this.options.notFoundRoute) {
345
+ destRoutes = [...destRoutes, this.options.notFoundRoute];
352
346
  }
347
+ let changedParams = false;
353
348
  if (Object.keys(nextParams).length > 0) {
354
349
  for (const route of destRoutes) {
355
350
  const fn = route.options.params?.stringify ?? route.options.stringifyParams;
356
351
  if (fn) {
352
+ changedParams = true;
357
353
  Object.assign(nextParams, fn(nextParams));
358
354
  }
359
355
  }
@@ -363,7 +359,7 @@ class RouterCore {
363
359
  // This preserves the original parameter syntax including optional parameters
364
360
  nextTo
365
361
  ) : utils.decodePath(
366
- path.interpolatePath({
362
+ !changedParams ? interpolatedNextTo : path.interpolatePath({
367
363
  path: nextTo,
368
364
  params: nextParams,
369
365
  decoder: this.pathParamsDecoder,