@tanstack/router-core 1.145.11 → 1.146.0
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/new-process-route-tree.cjs +137 -33
- package/dist/cjs/new-process-route-tree.cjs.map +1 -1
- package/dist/cjs/new-process-route-tree.d.cts +50 -6
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +39 -0
- package/dist/cjs/router.cjs +33 -23
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +5 -0
- package/dist/esm/new-process-route-tree.d.ts +50 -6
- package/dist/esm/new-process-route-tree.js +137 -33
- package/dist/esm/new-process-route-tree.js.map +1 -1
- package/dist/esm/route.d.ts +39 -0
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +5 -0
- package/dist/esm/router.js +33 -23
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/new-process-route-tree.ts +250 -49
- package/src/route.ts +39 -2
- package/src/router.ts +39 -25
package/dist/esm/router.js
CHANGED
|
@@ -394,7 +394,7 @@ class RouterCore {
|
|
|
394
394
|
this.processedTree
|
|
395
395
|
);
|
|
396
396
|
if (match) {
|
|
397
|
-
Object.assign(params, match.
|
|
397
|
+
Object.assign(params, match.rawParams);
|
|
398
398
|
const {
|
|
399
399
|
from: _from,
|
|
400
400
|
params: maskParams,
|
|
@@ -965,14 +965,14 @@ class RouterCore {
|
|
|
965
965
|
return false;
|
|
966
966
|
}
|
|
967
967
|
if (location.params) {
|
|
968
|
-
if (!deepEqual(match.
|
|
968
|
+
if (!deepEqual(match.rawParams, location.params, { partial: true })) {
|
|
969
969
|
return false;
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
972
|
if (opts?.includeSearch ?? true) {
|
|
973
|
-
return deepEqual(baseLocation.search, next.search, { partial: true }) ? match.
|
|
973
|
+
return deepEqual(baseLocation.search, next.search, { partial: true }) ? match.rawParams : false;
|
|
974
974
|
}
|
|
975
|
-
return match.
|
|
975
|
+
return match.rawParams;
|
|
976
976
|
};
|
|
977
977
|
this.hasNotFoundMatch = () => {
|
|
978
978
|
return this.__store.state.matches.some(
|
|
@@ -1008,7 +1008,7 @@ class RouterCore {
|
|
|
1008
1008
|
}
|
|
1009
1009
|
matchRoutesInternal(next, opts) {
|
|
1010
1010
|
const matchedRoutesResult = this.getMatchedRoutes(next.pathname);
|
|
1011
|
-
const { foundRoute, routeParams } = matchedRoutesResult;
|
|
1011
|
+
const { foundRoute, routeParams, parsedParams } = matchedRoutesResult;
|
|
1012
1012
|
let { matchedRoutes } = matchedRoutesResult;
|
|
1013
1013
|
let isGlobalNotFound = false;
|
|
1014
1014
|
if (
|
|
@@ -1094,23 +1094,31 @@ class RouterCore {
|
|
|
1094
1094
|
const strictParams = existingMatch?._strictParams ?? usedParams;
|
|
1095
1095
|
let paramsError = void 0;
|
|
1096
1096
|
if (!existingMatch) {
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
strictParams,
|
|
1102
|
-
strictParseParams(strictParams)
|
|
1103
|
-
);
|
|
1104
|
-
} catch (err) {
|
|
1105
|
-
if (isNotFound(err) || isRedirect(err)) {
|
|
1106
|
-
paramsError = err;
|
|
1107
|
-
} else {
|
|
1108
|
-
paramsError = new PathParamError(err.message, {
|
|
1109
|
-
cause: err
|
|
1110
|
-
});
|
|
1097
|
+
if (route.options.skipRouteOnParseError) {
|
|
1098
|
+
for (const key in usedParams) {
|
|
1099
|
+
if (key in parsedParams) {
|
|
1100
|
+
strictParams[key] = parsedParams[key];
|
|
1111
1101
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1102
|
+
}
|
|
1103
|
+
} else {
|
|
1104
|
+
const strictParseParams = route.options.params?.parse ?? route.options.parseParams;
|
|
1105
|
+
if (strictParseParams) {
|
|
1106
|
+
try {
|
|
1107
|
+
Object.assign(
|
|
1108
|
+
strictParams,
|
|
1109
|
+
strictParseParams(strictParams)
|
|
1110
|
+
);
|
|
1111
|
+
} catch (err) {
|
|
1112
|
+
if (isNotFound(err) || isRedirect(err)) {
|
|
1113
|
+
paramsError = err;
|
|
1114
|
+
} else {
|
|
1115
|
+
paramsError = new PathParamError(err.message, {
|
|
1116
|
+
cause: err
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
if (opts?.throwOnError) {
|
|
1120
|
+
throw paramsError;
|
|
1121
|
+
}
|
|
1114
1122
|
}
|
|
1115
1123
|
}
|
|
1116
1124
|
}
|
|
@@ -1264,13 +1272,15 @@ function getMatchedRoutes({
|
|
|
1264
1272
|
const routeParams = {};
|
|
1265
1273
|
const trimmedPath = trimPathRight(pathname);
|
|
1266
1274
|
let foundRoute = void 0;
|
|
1275
|
+
let parsedParams = void 0;
|
|
1267
1276
|
const match = findRouteMatch(trimmedPath, processedTree, true);
|
|
1268
1277
|
if (match) {
|
|
1269
1278
|
foundRoute = match.route;
|
|
1270
|
-
Object.assign(routeParams, match.
|
|
1279
|
+
Object.assign(routeParams, match.rawParams);
|
|
1280
|
+
parsedParams = Object.assign({}, match.parsedParams);
|
|
1271
1281
|
}
|
|
1272
1282
|
const matchedRoutes = match?.branch || [routesById[rootRouteId]];
|
|
1273
|
-
return { matchedRoutes, routeParams, foundRoute };
|
|
1283
|
+
return { matchedRoutes, routeParams, foundRoute, parsedParams };
|
|
1274
1284
|
}
|
|
1275
1285
|
function applySearchMiddleware({
|
|
1276
1286
|
search,
|