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