@tanstack/router-core 1.131.17 → 1.131.18
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 +32 -27
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/esm/router.js +32 -27
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +26 -21
package/dist/esm/router.js
CHANGED
|
@@ -1113,10 +1113,12 @@ class RouterCore {
|
|
|
1113
1113
|
this.getMatch(matchId),
|
|
1114
1114
|
loaderData
|
|
1115
1115
|
);
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1116
|
+
if (loaderData !== void 0) {
|
|
1117
|
+
innerLoadContext.updateMatch(matchId, (prev) => ({
|
|
1118
|
+
...prev,
|
|
1119
|
+
loaderData
|
|
1120
|
+
}));
|
|
1121
|
+
}
|
|
1120
1122
|
}
|
|
1121
1123
|
if (route._lazyPromise) await route._lazyPromise;
|
|
1122
1124
|
const headResult = this.executeHead(innerLoadContext, matchId, route);
|
|
@@ -1201,9 +1203,9 @@ class RouterCore {
|
|
|
1201
1203
|
return this.getMatch(matchId);
|
|
1202
1204
|
}
|
|
1203
1205
|
await prevMatch._nonReactive.loaderPromise;
|
|
1204
|
-
const
|
|
1205
|
-
if (
|
|
1206
|
-
this.handleRedirectAndNotFound(innerLoadContext,
|
|
1206
|
+
const match2 = this.getMatch(matchId);
|
|
1207
|
+
if (match2.error) {
|
|
1208
|
+
this.handleRedirectAndNotFound(innerLoadContext, match2, match2.error);
|
|
1207
1209
|
}
|
|
1208
1210
|
} else {
|
|
1209
1211
|
const age = Date.now() - this.getMatch(matchId).updatedAt;
|
|
@@ -1213,13 +1215,15 @@ class RouterCore {
|
|
|
1213
1215
|
const shouldReload = typeof shouldReloadOption === "function" ? shouldReloadOption(
|
|
1214
1216
|
this.getLoaderContext(innerLoadContext, matchId, index, route)
|
|
1215
1217
|
) : shouldReloadOption;
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1218
|
+
const nextPreload = !!preload && !this.state.matches.some((d) => d.id === matchId);
|
|
1219
|
+
const match2 = this.getMatch(matchId);
|
|
1220
|
+
match2._nonReactive.loaderPromise = createControlledPromise();
|
|
1221
|
+
if (nextPreload !== match2.preload) {
|
|
1222
|
+
innerLoadContext.updateMatch(matchId, (prev) => ({
|
|
1219
1223
|
...prev,
|
|
1220
|
-
preload:
|
|
1221
|
-
};
|
|
1222
|
-
}
|
|
1224
|
+
preload: nextPreload
|
|
1225
|
+
}));
|
|
1226
|
+
}
|
|
1223
1227
|
const { status, invalid } = this.getMatch(matchId);
|
|
1224
1228
|
loaderShouldRunAsync = status === "success" && (invalid || (shouldReload ?? age > staleAge));
|
|
1225
1229
|
if (preload && route.options.preload === false) ;
|
|
@@ -1229,10 +1233,10 @@ class RouterCore {
|
|
|
1229
1233
|
var _a2, _b2;
|
|
1230
1234
|
try {
|
|
1231
1235
|
await this.runLoader(innerLoadContext, matchId, index, route);
|
|
1232
|
-
const
|
|
1233
|
-
(_a2 =
|
|
1234
|
-
(_b2 =
|
|
1235
|
-
|
|
1236
|
+
const match3 = this.getMatch(matchId);
|
|
1237
|
+
(_a2 = match3._nonReactive.loaderPromise) == null ? void 0 : _a2.resolve();
|
|
1238
|
+
(_b2 = match3._nonReactive.loadPromise) == null ? void 0 : _b2.resolve();
|
|
1239
|
+
match3._nonReactive.loaderPromise = void 0;
|
|
1236
1240
|
} catch (err) {
|
|
1237
1241
|
if (isRedirect(err)) {
|
|
1238
1242
|
await this.navigate(err.options);
|
|
@@ -1252,22 +1256,23 @@ class RouterCore {
|
|
|
1252
1256
|
}
|
|
1253
1257
|
}
|
|
1254
1258
|
}
|
|
1259
|
+
const match = this.getMatch(matchId);
|
|
1255
1260
|
if (!loaderIsRunningAsync) {
|
|
1256
|
-
const match = this.getMatch(matchId);
|
|
1257
1261
|
(_a = match._nonReactive.loaderPromise) == null ? void 0 : _a.resolve();
|
|
1258
1262
|
(_b = match._nonReactive.loadPromise) == null ? void 0 : _b.resolve();
|
|
1259
1263
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1264
|
+
clearTimeout(match._nonReactive.pendingTimeout);
|
|
1265
|
+
match._nonReactive.pendingTimeout = void 0;
|
|
1266
|
+
if (!loaderIsRunningAsync) match._nonReactive.loaderPromise = void 0;
|
|
1267
|
+
match._nonReactive.dehydrated = void 0;
|
|
1268
|
+
const nextIsFetching = loaderIsRunningAsync ? match.isFetching : false;
|
|
1269
|
+
if (nextIsFetching !== match.isFetching || match.invalid !== false) {
|
|
1270
|
+
innerLoadContext.updateMatch(matchId, (prev) => ({
|
|
1266
1271
|
...prev,
|
|
1267
|
-
isFetching:
|
|
1272
|
+
isFetching: nextIsFetching,
|
|
1268
1273
|
invalid: false
|
|
1269
|
-
};
|
|
1270
|
-
}
|
|
1274
|
+
}));
|
|
1275
|
+
}
|
|
1271
1276
|
return this.getMatch(matchId);
|
|
1272
1277
|
};
|
|
1273
1278
|
this.loadMatches = async (baseContext) => {
|