@tanstack/router-core 1.131.36 → 1.131.37
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 +25 -7
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +25 -7
- 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
|
@@ -957,7 +957,7 @@ class RouterCore {
|
|
|
957
957
|
return parentContext;
|
|
958
958
|
};
|
|
959
959
|
matchedRoutes.forEach((route, index) => {
|
|
960
|
-
var _a2, _b;
|
|
960
|
+
var _a2, _b, _c;
|
|
961
961
|
const parentMatch = matches[index - 1];
|
|
962
962
|
const [preMatchSearch, strictMatchSearch, searchError] = (() => {
|
|
963
963
|
const parentSearch = (parentMatch == null ? void 0 : parentMatch.search) ?? next.search;
|
|
@@ -989,18 +989,36 @@ class RouterCore {
|
|
|
989
989
|
search: preMatchSearch
|
|
990
990
|
})) ?? "";
|
|
991
991
|
const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : "";
|
|
992
|
-
const {
|
|
992
|
+
const { interpolatedPath } = path.interpolatePath({
|
|
993
993
|
path: route.fullPath,
|
|
994
994
|
params: routeParams,
|
|
995
995
|
decodeCharMap: this.pathParamsDecodeCharMap
|
|
996
996
|
});
|
|
997
|
-
const
|
|
997
|
+
const interpolatePathResult = path.interpolatePath({
|
|
998
998
|
path: route.id,
|
|
999
999
|
params: routeParams,
|
|
1000
1000
|
leaveWildcards: true,
|
|
1001
1001
|
decodeCharMap: this.pathParamsDecodeCharMap,
|
|
1002
1002
|
parseCache: this.parsePathnameCache
|
|
1003
|
-
})
|
|
1003
|
+
});
|
|
1004
|
+
const strictParams = interpolatePathResult.usedParams;
|
|
1005
|
+
let paramsError = parseErrors[index];
|
|
1006
|
+
const strictParseParams = ((_c = route.options.params) == null ? void 0 : _c.parse) ?? route.options.parseParams;
|
|
1007
|
+
if (strictParseParams) {
|
|
1008
|
+
try {
|
|
1009
|
+
Object.assign(strictParams, strictParseParams(strictParams));
|
|
1010
|
+
} catch (err) {
|
|
1011
|
+
if (!paramsError) {
|
|
1012
|
+
paramsError = new PathParamError(err.message, {
|
|
1013
|
+
cause: err
|
|
1014
|
+
});
|
|
1015
|
+
if (opts == null ? void 0 : opts.throwOnError) {
|
|
1016
|
+
throw paramsError;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
const matchId = interpolatePathResult.interpolatedPath + loaderDepsHash;
|
|
1004
1022
|
const existingMatch = this.getMatch(matchId);
|
|
1005
1023
|
const previousMatch = this.state.matches.find(
|
|
1006
1024
|
(d) => d.routeId === route.id
|
|
@@ -1012,7 +1030,7 @@ class RouterCore {
|
|
|
1012
1030
|
...existingMatch,
|
|
1013
1031
|
cause,
|
|
1014
1032
|
params: previousMatch ? utils.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
|
|
1015
|
-
_strictParams:
|
|
1033
|
+
_strictParams: strictParams,
|
|
1016
1034
|
search: previousMatch ? utils.replaceEqualDeep(previousMatch.search, preMatchSearch) : utils.replaceEqualDeep(existingMatch.search, preMatchSearch),
|
|
1017
1035
|
_strictSearch: strictMatchSearch
|
|
1018
1036
|
};
|
|
@@ -1023,7 +1041,7 @@ class RouterCore {
|
|
|
1023
1041
|
index,
|
|
1024
1042
|
routeId: route.id,
|
|
1025
1043
|
params: previousMatch ? utils.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
|
|
1026
|
-
_strictParams:
|
|
1044
|
+
_strictParams: strictParams,
|
|
1027
1045
|
pathname: path.joinPaths([this.basepath, interpolatedPath]),
|
|
1028
1046
|
updatedAt: Date.now(),
|
|
1029
1047
|
search: previousMatch ? utils.replaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
|
|
@@ -1032,7 +1050,7 @@ class RouterCore {
|
|
|
1032
1050
|
status,
|
|
1033
1051
|
isFetching: false,
|
|
1034
1052
|
error: void 0,
|
|
1035
|
-
paramsError
|
|
1053
|
+
paramsError,
|
|
1036
1054
|
__routeContext: void 0,
|
|
1037
1055
|
_nonReactive: {
|
|
1038
1056
|
loadPromise: utils.createControlledPromise()
|