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