@tanstack/react-router 1.90.0 → 1.91.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.
@@ -1052,28 +1052,7 @@ class Router {
1052
1052
  }
1053
1053
  };
1054
1054
  try {
1055
- if (route._lazyPromise === void 0) {
1056
- if (route.lazyFn) {
1057
- route._lazyPromise = route.lazyFn().then((lazyRoute) => {
1058
- const { id: _id, ...options2 } = lazyRoute.options;
1059
- Object.assign(route.options, options2);
1060
- });
1061
- } else {
1062
- route._lazyPromise = Promise.resolve();
1063
- }
1064
- }
1065
- if (route._componentsPromise === void 0) {
1066
- route._componentsPromise = route._lazyPromise.then(
1067
- () => Promise.all(
1068
- componentTypes.map(async (type) => {
1069
- const component = route.options[type];
1070
- if (component == null ? void 0 : component.preload) {
1071
- await component.preload();
1072
- }
1073
- })
1074
- )
1075
- );
1076
- }
1055
+ this.loadRouteChunk(route);
1077
1056
  updateMatch(matchId, (prev) => ({
1078
1057
  ...prev,
1079
1058
  isFetching: "loader"
@@ -1258,6 +1237,31 @@ class Router {
1258
1237
  };
1259
1238
  this.clearCache({ filter });
1260
1239
  };
1240
+ this.loadRouteChunk = (route) => {
1241
+ if (route._lazyPromise === void 0) {
1242
+ if (route.lazyFn) {
1243
+ route._lazyPromise = route.lazyFn().then((lazyRoute) => {
1244
+ const { id: _id, ...options2 } = lazyRoute.options;
1245
+ Object.assign(route.options, options2);
1246
+ });
1247
+ } else {
1248
+ route._lazyPromise = Promise.resolve();
1249
+ }
1250
+ }
1251
+ if (route._componentsPromise === void 0) {
1252
+ route._componentsPromise = route._lazyPromise.then(
1253
+ () => Promise.all(
1254
+ componentTypes.map(async (type) => {
1255
+ const component = route.options[type];
1256
+ if (component == null ? void 0 : component.preload) {
1257
+ await component.preload();
1258
+ }
1259
+ })
1260
+ )
1261
+ );
1262
+ }
1263
+ return route._componentsPromise;
1264
+ };
1261
1265
  this.preloadRoute = async (opts) => {
1262
1266
  const next = this.buildLocation(opts);
1263
1267
  let matches = this.matchRoutes(next, {