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