@tanstack/react-router 1.57.18 → 1.58.2

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.
@@ -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
  }
@@ -858,7 +867,6 @@ class Router {
858
867
  isFetching: "loader",
859
868
  componentsPromise
860
869
  }));
861
- await route._lazyPromise;
862
870
  let loaderData = await ((_b2 = (_a2 = route.options).loader) == null ? void 0 : _b2.call(_a2, getLoaderContext()));
863
871
  if (this.serializeLoaderData) {
864
872
  loaderData = this.serializeLoaderData(
@@ -874,6 +882,7 @@ class Router {
874
882
  this.getMatch(matchId),
875
883
  loaderData
876
884
  );
885
+ await route._lazyPromise;
877
886
  await potentialPendingMinPromise();
878
887
  const meta = (_d = (_c2 = route.options).meta) == null ? void 0 : _d.call(_c2, {
879
888
  matches,
@@ -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,