@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/esm/router.js
CHANGED
|
@@ -15,6 +15,15 @@ const componentTypes = [
|
|
|
15
15
|
"pendingComponent",
|
|
16
16
|
"notFoundComponent"
|
|
17
17
|
];
|
|
18
|
+
function routeNeedsPreload(route) {
|
|
19
|
+
var _a;
|
|
20
|
+
for (const componentType of componentTypes) {
|
|
21
|
+
if ((_a = route.options[componentType]) == null ? void 0 : _a.preload) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
18
27
|
function createRouter(options) {
|
|
19
28
|
return new Router(options);
|
|
20
29
|
}
|
|
@@ -1369,7 +1378,7 @@ class Router {
|
|
|
1369
1378
|
params: routeParams
|
|
1370
1379
|
};
|
|
1371
1380
|
} else {
|
|
1372
|
-
const status = route.options.loader || route.options.beforeLoad || route.lazyFn ? "pending" : "success";
|
|
1381
|
+
const status = route.options.loader || route.options.beforeLoad || route.lazyFn || routeNeedsPreload(route) ? "pending" : "success";
|
|
1373
1382
|
match = {
|
|
1374
1383
|
id: matchId,
|
|
1375
1384
|
index,
|