@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.
- package/dist/cjs/index.d.cts +2 -1
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/link.d.cts +19 -23
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +3 -3
- package/dist/cjs/routeInfo.d.cts +3 -3
- package/dist/cjs/router.cjs +26 -22
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +1 -0
- package/dist/cjs/typePrimitives.d.cts +62 -0
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/cjs/utils.d.cts +3 -2
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/link.d.ts +19 -23
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/route.d.ts +3 -3
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/routeInfo.d.ts +3 -3
- package/dist/esm/router.d.ts +1 -0
- package/dist/esm/router.js +26 -22
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/typePrimitives.d.ts +62 -0
- package/dist/esm/utils.d.ts +3 -2
- package/dist/esm/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +2 -6
- package/src/link.tsx +107 -144
- package/src/route.ts +14 -7
- package/src/routeInfo.ts +6 -13
- package/src/router.ts +32 -31
- package/src/typePrimitives.ts +168 -0
- package/src/utils.ts +9 -5
package/dist/cjs/router.cjs
CHANGED
|
@@ -1052,28 +1052,7 @@ class Router {
|
|
|
1052
1052
|
}
|
|
1053
1053
|
};
|
|
1054
1054
|
try {
|
|
1055
|
-
|
|
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, {
|