@tanstack/react-router 1.97.25 → 1.98.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/Match.cjs +18 -6
- package/dist/cjs/Match.cjs.map +1 -1
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +2 -0
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/lazyRouteComponent.cjs +17 -13
- package/dist/cjs/lazyRouteComponent.cjs.map +1 -1
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +10 -2
- package/dist/cjs/router.cjs +23 -11
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +2 -1
- package/dist/esm/Match.js +18 -6
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Matches.d.ts +2 -0
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/lazyRouteComponent.js +17 -13
- package/dist/esm/lazyRouteComponent.js.map +1 -1
- package/dist/esm/route.d.ts +10 -2
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +2 -1
- package/dist/esm/router.js +23 -11
- package/dist/esm/router.js.map +1 -1
- package/package.json +3 -3
- package/src/Match.tsx +22 -6
- package/src/Matches.tsx +2 -0
- package/src/index.tsx +2 -0
- package/src/lazyRouteComponent.tsx +34 -31
- package/src/route.ts +38 -1
- package/src/router.ts +32 -11
package/dist/cjs/router.cjs
CHANGED
|
@@ -329,7 +329,7 @@ class Router {
|
|
|
329
329
|
path: route.fullPath,
|
|
330
330
|
params: (matchedRoutesResult == null ? void 0 : matchedRoutesResult.routeParams) ?? {},
|
|
331
331
|
decodeCharMap: this.pathParamsDecodeCharMap
|
|
332
|
-
});
|
|
332
|
+
}).interpolatedPath;
|
|
333
333
|
const pathname2 = routerCore.joinPaths([this.basepath, interpolatedPath]);
|
|
334
334
|
return pathname2 === fromPath;
|
|
335
335
|
})) == null ? void 0 : _d.id];
|
|
@@ -357,7 +357,7 @@ class Router {
|
|
|
357
357
|
leaveWildcards: false,
|
|
358
358
|
leaveParams: opts.leaveParams,
|
|
359
359
|
decodeCharMap: this.pathParamsDecodeCharMap
|
|
360
|
-
});
|
|
360
|
+
}).interpolatedPath;
|
|
361
361
|
let search = fromSearch;
|
|
362
362
|
if (opts._includeValidateSearch && ((_f = this.options.search) == null ? void 0 : _f.strict)) {
|
|
363
363
|
let validatedSearch = {};
|
|
@@ -816,7 +816,7 @@ class Router {
|
|
|
816
816
|
triggerOnReady();
|
|
817
817
|
}
|
|
818
818
|
const handleRedirectAndNotFound = (match, err) => {
|
|
819
|
-
var _a, _b, _c;
|
|
819
|
+
var _a, _b, _c, _d;
|
|
820
820
|
if (redirects.isResolvedRedirect(err)) {
|
|
821
821
|
if (!err.reloadDocument) {
|
|
822
822
|
throw err;
|
|
@@ -845,6 +845,10 @@ class Router {
|
|
|
845
845
|
this._handleNotFound(matches, err, {
|
|
846
846
|
updateMatch
|
|
847
847
|
});
|
|
848
|
+
(_d = this.serverSsr) == null ? void 0 : _d.onMatchSettled({
|
|
849
|
+
router: this,
|
|
850
|
+
match: this.getMatch(match.id)
|
|
851
|
+
});
|
|
848
852
|
throw err;
|
|
849
853
|
}
|
|
850
854
|
}
|
|
@@ -1314,7 +1318,9 @@ class Router {
|
|
|
1314
1318
|
_fromLocation: next
|
|
1315
1319
|
});
|
|
1316
1320
|
}
|
|
1317
|
-
|
|
1321
|
+
if (!notFound.isNotFound(err)) {
|
|
1322
|
+
console.error(err);
|
|
1323
|
+
}
|
|
1318
1324
|
return void 0;
|
|
1319
1325
|
}
|
|
1320
1326
|
};
|
|
@@ -1481,15 +1487,17 @@ class Router {
|
|
|
1481
1487
|
matchedRoutes.forEach((route, index) => {
|
|
1482
1488
|
var _a, _b, _c, _d;
|
|
1483
1489
|
const parentMatch = matches[index - 1];
|
|
1484
|
-
const [preMatchSearch, searchError] = (() => {
|
|
1490
|
+
const [preMatchSearch, strictMatchSearch, searchError] = (() => {
|
|
1485
1491
|
const parentSearch = (parentMatch == null ? void 0 : parentMatch.search) ?? next.search;
|
|
1492
|
+
const parentStrictSearch = (parentMatch == null ? void 0 : parentMatch._strictSearch) ?? {};
|
|
1486
1493
|
try {
|
|
1487
|
-
const
|
|
1494
|
+
const strictSearch = validateSearch(route.options.validateSearch, { ...parentSearch }) ?? {};
|
|
1488
1495
|
return [
|
|
1489
1496
|
{
|
|
1490
1497
|
...parentSearch,
|
|
1491
|
-
...
|
|
1498
|
+
...strictSearch
|
|
1492
1499
|
},
|
|
1500
|
+
{ ...parentStrictSearch, ...strictSearch },
|
|
1493
1501
|
void 0
|
|
1494
1502
|
];
|
|
1495
1503
|
} catch (err) {
|
|
@@ -1502,14 +1510,14 @@ class Router {
|
|
|
1502
1510
|
if (opts == null ? void 0 : opts.throwOnError) {
|
|
1503
1511
|
throw searchParamError;
|
|
1504
1512
|
}
|
|
1505
|
-
return [parentSearch, searchParamError];
|
|
1513
|
+
return [parentSearch, {}, searchParamError];
|
|
1506
1514
|
}
|
|
1507
1515
|
})();
|
|
1508
1516
|
const loaderDeps = ((_b = (_a = route.options).loaderDeps) == null ? void 0 : _b.call(_a, {
|
|
1509
1517
|
search: preMatchSearch
|
|
1510
1518
|
})) ?? "";
|
|
1511
1519
|
const loaderDepsHash = loaderDeps ? JSON.stringify(loaderDeps) : "";
|
|
1512
|
-
const interpolatedPath = routerCore.interpolatePath({
|
|
1520
|
+
const { usedParams, interpolatedPath } = routerCore.interpolatePath({
|
|
1513
1521
|
path: route.fullPath,
|
|
1514
1522
|
params: routeParams,
|
|
1515
1523
|
decodeCharMap: this.pathParamsDecodeCharMap
|
|
@@ -1519,7 +1527,7 @@ class Router {
|
|
|
1519
1527
|
params: routeParams,
|
|
1520
1528
|
leaveWildcards: true,
|
|
1521
1529
|
decodeCharMap: this.pathParamsDecodeCharMap
|
|
1522
|
-
}) + loaderDepsHash;
|
|
1530
|
+
}).interpolatedPath + loaderDepsHash;
|
|
1523
1531
|
const existingMatch = this.getMatch(matchId);
|
|
1524
1532
|
const previousMatch = this.state.matches.find(
|
|
1525
1533
|
(d) => d.routeId === route.id
|
|
@@ -1531,7 +1539,9 @@ class Router {
|
|
|
1531
1539
|
...existingMatch,
|
|
1532
1540
|
cause,
|
|
1533
1541
|
params: previousMatch ? routerCore.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
|
|
1534
|
-
|
|
1542
|
+
_strictParams: usedParams,
|
|
1543
|
+
search: previousMatch ? routerCore.replaceEqualDeep(previousMatch.search, preMatchSearch) : routerCore.replaceEqualDeep(existingMatch.search, preMatchSearch),
|
|
1544
|
+
_strictSearch: strictMatchSearch
|
|
1535
1545
|
};
|
|
1536
1546
|
} else {
|
|
1537
1547
|
const status = route.options.loader || route.options.beforeLoad || route.lazyFn || routeNeedsPreload(route) ? "pending" : "success";
|
|
@@ -1540,9 +1550,11 @@ class Router {
|
|
|
1540
1550
|
index,
|
|
1541
1551
|
routeId: route.id,
|
|
1542
1552
|
params: previousMatch ? routerCore.replaceEqualDeep(previousMatch.params, routeParams) : routeParams,
|
|
1553
|
+
_strictParams: usedParams,
|
|
1543
1554
|
pathname: routerCore.joinPaths([this.basepath, interpolatedPath]),
|
|
1544
1555
|
updatedAt: Date.now(),
|
|
1545
1556
|
search: previousMatch ? routerCore.replaceEqualDeep(previousMatch.search, preMatchSearch) : preMatchSearch,
|
|
1557
|
+
_strictSearch: strictMatchSearch,
|
|
1546
1558
|
searchError: void 0,
|
|
1547
1559
|
status,
|
|
1548
1560
|
isFetching: false,
|