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