@tanstack/router-core 1.132.0-alpha.18 → 1.132.0-alpha.19
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 +24 -6
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +24 -6
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +38 -12
package/dist/esm/router.js
CHANGED
|
@@ -993,18 +993,36 @@ class RouterCore {
|
|
|
993
993
|
search: preMatchSearch
|
|
994
994
|
}) ?? "";
|
|
995
995
|
const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : "";
|
|
996
|
-
const {
|
|
996
|
+
const { interpolatedPath } = interpolatePath({
|
|
997
997
|
path: route.fullPath,
|
|
998
998
|
params: routeParams,
|
|
999
999
|
decodeCharMap: this.pathParamsDecodeCharMap
|
|
1000
1000
|
});
|
|
1001
|
-
const
|
|
1001
|
+
const interpolatePathResult = interpolatePath({
|
|
1002
1002
|
path: route.id,
|
|
1003
1003
|
params: routeParams,
|
|
1004
1004
|
leaveWildcards: true,
|
|
1005
1005
|
decodeCharMap: this.pathParamsDecodeCharMap,
|
|
1006
1006
|
parseCache: this.parsePathnameCache
|
|
1007
|
-
})
|
|
1007
|
+
});
|
|
1008
|
+
const strictParams = interpolatePathResult.usedParams;
|
|
1009
|
+
let paramsError = parseErrors[index];
|
|
1010
|
+
const strictParseParams = route.options.params?.parse ?? route.options.parseParams;
|
|
1011
|
+
if (strictParseParams) {
|
|
1012
|
+
try {
|
|
1013
|
+
Object.assign(strictParams, strictParseParams(strictParams));
|
|
1014
|
+
} catch (err) {
|
|
1015
|
+
if (!paramsError) {
|
|
1016
|
+
paramsError = new PathParamError(err.message, {
|
|
1017
|
+
cause: err
|
|
1018
|
+
});
|
|
1019
|
+
if (opts?.throwOnError) {
|
|
1020
|
+
throw paramsError;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
const matchId = interpolatePathResult.interpolatedPath + loaderDepsHash;
|
|
1008
1026
|
const existingMatch = this.getMatch(matchId);
|
|
1009
1027
|
const previousMatch = this.state.matches.find(
|
|
1010
1028
|
(d) => d.routeId === route.id
|
|
@@ -1016,7 +1034,7 @@ class RouterCore {
|
|
|
1016
1034
|
...existingMatch,
|
|
1017
1035
|
cause,
|
|
1018
1036
|
params: previousMatch ? replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
|
|
1019
|
-
_strictParams:
|
|
1037
|
+
_strictParams: strictParams,
|
|
1020
1038
|
search: previousMatch ? replaceEqualDeep(previousMatch.search, preMatchSearch) : replaceEqualDeep(existingMatch.search, preMatchSearch),
|
|
1021
1039
|
_strictSearch: strictMatchSearch
|
|
1022
1040
|
};
|
|
@@ -1027,7 +1045,7 @@ class RouterCore {
|
|
|
1027
1045
|
index,
|
|
1028
1046
|
routeId: route.id,
|
|
1029
1047
|
params: previousMatch ? replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
|
|
1030
|
-
_strictParams:
|
|
1048
|
+
_strictParams: strictParams,
|
|
1031
1049
|
pathname: interpolatedPath,
|
|
1032
1050
|
updatedAt: Date.now(),
|
|
1033
1051
|
search: previousMatch ? replaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
|
|
@@ -1036,7 +1054,7 @@ class RouterCore {
|
|
|
1036
1054
|
status,
|
|
1037
1055
|
isFetching: false,
|
|
1038
1056
|
error: void 0,
|
|
1039
|
-
paramsError
|
|
1057
|
+
paramsError,
|
|
1040
1058
|
__routeContext: void 0,
|
|
1041
1059
|
_nonReactive: {
|
|
1042
1060
|
loadPromise: createControlledPromise()
|