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