@tanstack/router-core 1.131.36 → 1.131.38

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.
@@ -930,26 +930,6 @@ class RouterCore {
930
930
  }
931
931
  return root.rootRouteId;
932
932
  })();
933
- const parseErrors = matchedRoutes.map((route) => {
934
- var _a2;
935
- let parsedParamsError;
936
- const parseParams = ((_a2 = route.options.params) == null ? void 0 : _a2.parse) ?? route.options.parseParams;
937
- if (parseParams) {
938
- try {
939
- const parsedParams = parseParams(routeParams);
940
- Object.assign(routeParams, parsedParams);
941
- } catch (err) {
942
- parsedParamsError = new PathParamError(err.message, {
943
- cause: err
944
- });
945
- if (opts == null ? void 0 : opts.throwOnError) {
946
- throw parsedParamsError;
947
- }
948
- return parsedParamsError;
949
- }
950
- }
951
- return;
952
- });
953
933
  const matches = [];
954
934
  const getParentContext = (parentMatch) => {
955
935
  const parentMatchId = parentMatch == null ? void 0 : parentMatch.id;
@@ -957,7 +937,7 @@ class RouterCore {
957
937
  return parentContext;
958
938
  };
959
939
  matchedRoutes.forEach((route, index) => {
960
- var _a2, _b;
940
+ var _a2, _b, _c;
961
941
  const parentMatch = matches[index - 1];
962
942
  const [preMatchSearch, strictMatchSearch, searchError] = (() => {
963
943
  const parentSearch = (parentMatch == null ? void 0 : parentMatch.search) ?? next.search;
@@ -989,22 +969,44 @@ class RouterCore {
989
969
  search: preMatchSearch
990
970
  })) ?? "";
991
971
  const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : "";
992
- const { usedParams, interpolatedPath } = path.interpolatePath({
972
+ const { interpolatedPath } = path.interpolatePath({
993
973
  path: route.fullPath,
994
974
  params: routeParams,
995
975
  decodeCharMap: this.pathParamsDecodeCharMap
996
976
  });
997
- const matchId = path.interpolatePath({
977
+ const interpolatePathResult = path.interpolatePath({
998
978
  path: route.id,
999
979
  params: routeParams,
1000
980
  leaveWildcards: true,
1001
981
  decodeCharMap: this.pathParamsDecodeCharMap,
1002
982
  parseCache: this.parsePathnameCache
1003
- }).interpolatedPath + loaderDepsHash;
983
+ });
984
+ const matchId = interpolatePathResult.interpolatedPath + loaderDepsHash;
1004
985
  const existingMatch = this.getMatch(matchId);
1005
986
  const previousMatch = this.state.matches.find(
1006
987
  (d) => d.routeId === route.id
1007
988
  );
989
+ const strictParams = (existingMatch == null ? void 0 : existingMatch._strictParams) ?? interpolatePathResult.usedParams;
990
+ let paramsError = void 0;
991
+ if (!existingMatch) {
992
+ const strictParseParams = ((_c = route.options.params) == null ? void 0 : _c.parse) ?? route.options.parseParams;
993
+ if (strictParseParams) {
994
+ try {
995
+ Object.assign(
996
+ strictParams,
997
+ strictParseParams(strictParams)
998
+ );
999
+ } catch (err) {
1000
+ paramsError = new PathParamError(err.message, {
1001
+ cause: err
1002
+ });
1003
+ if (opts == null ? void 0 : opts.throwOnError) {
1004
+ throw paramsError;
1005
+ }
1006
+ }
1007
+ }
1008
+ }
1009
+ Object.assign(routeParams, strictParams);
1008
1010
  const cause = previousMatch ? "stay" : "enter";
1009
1011
  let match;
1010
1012
  if (existingMatch) {
@@ -1012,7 +1014,7 @@ class RouterCore {
1012
1014
  ...existingMatch,
1013
1015
  cause,
1014
1016
  params: previousMatch ? utils.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
1015
- _strictParams: usedParams,
1017
+ _strictParams: strictParams,
1016
1018
  search: previousMatch ? utils.replaceEqualDeep(previousMatch.search, preMatchSearch) : utils.replaceEqualDeep(existingMatch.search, preMatchSearch),
1017
1019
  _strictSearch: strictMatchSearch
1018
1020
  };
@@ -1023,7 +1025,7 @@ class RouterCore {
1023
1025
  index,
1024
1026
  routeId: route.id,
1025
1027
  params: previousMatch ? utils.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
1026
- _strictParams: usedParams,
1028
+ _strictParams: strictParams,
1027
1029
  pathname: path.joinPaths([this.basepath, interpolatedPath]),
1028
1030
  updatedAt: Date.now(),
1029
1031
  search: previousMatch ? utils.replaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
@@ -1032,7 +1034,7 @@ class RouterCore {
1032
1034
  status,
1033
1035
  isFetching: false,
1034
1036
  error: void 0,
1035
- paramsError: parseErrors[index],
1037
+ paramsError,
1036
1038
  __routeContext: void 0,
1037
1039
  _nonReactive: {
1038
1040
  loadPromise: utils.createControlledPromise()