@tanstack/react-router 1.57.18 → 1.58.1
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 +10 -1
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +10 -1
- package/dist/esm/router.js.map +1 -1
- package/package.json +2 -2
- package/src/router.ts +13 -1
package/dist/cjs/router.cjs
CHANGED
|
@@ -17,6 +17,15 @@ const componentTypes = [
|
|
|
17
17
|
"pendingComponent",
|
|
18
18
|
"notFoundComponent"
|
|
19
19
|
];
|
|
20
|
+
function routeNeedsPreload(route) {
|
|
21
|
+
var _a;
|
|
22
|
+
for (const componentType of componentTypes) {
|
|
23
|
+
if ((_a = route.options[componentType]) == null ? void 0 : _a.preload) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
20
29
|
function createRouter(options) {
|
|
21
30
|
return new Router(options);
|
|
22
31
|
}
|
|
@@ -1371,7 +1380,7 @@ class Router {
|
|
|
1371
1380
|
params: routeParams
|
|
1372
1381
|
};
|
|
1373
1382
|
} else {
|
|
1374
|
-
const status = route.options.loader || route.options.beforeLoad || route.lazyFn ? "pending" : "success";
|
|
1383
|
+
const status = route.options.loader || route.options.beforeLoad || route.lazyFn || routeNeedsPreload(route) ? "pending" : "success";
|
|
1375
1384
|
match = {
|
|
1376
1385
|
id: matchId,
|
|
1377
1386
|
index,
|