@tanstack/router-core 1.134.13 → 1.134.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 +21 -3
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +1 -0
- package/dist/esm/router.d.ts +1 -0
- package/dist/esm/router.js +21 -3
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +30 -3
package/dist/cjs/router.cjs
CHANGED
|
@@ -271,13 +271,24 @@ class RouterCore {
|
|
|
271
271
|
match._nonReactive.pendingTimeout = void 0;
|
|
272
272
|
};
|
|
273
273
|
this.cancelMatches = () => {
|
|
274
|
-
this.state.
|
|
274
|
+
const currentPendingMatches = this.state.matches.filter(
|
|
275
|
+
(match) => match.status === "pending"
|
|
276
|
+
);
|
|
277
|
+
const currentLoadingMatches = this.state.matches.filter(
|
|
278
|
+
(match) => match.isFetching === "loader"
|
|
279
|
+
);
|
|
280
|
+
const matchesToCancelArray = /* @__PURE__ */ new Set([
|
|
281
|
+
...this.state.pendingMatches ?? [],
|
|
282
|
+
...currentPendingMatches,
|
|
283
|
+
...currentLoadingMatches
|
|
284
|
+
]);
|
|
285
|
+
matchesToCancelArray.forEach((match) => {
|
|
275
286
|
this.cancelMatch(match.id);
|
|
276
287
|
});
|
|
277
288
|
};
|
|
278
289
|
this.buildLocation = (opts) => {
|
|
279
290
|
const build = (dest = {}) => {
|
|
280
|
-
const currentLocation = dest._fromLocation || this.latestLocation;
|
|
291
|
+
const currentLocation = dest._fromLocation || this.pendingBuiltLocation || this.latestLocation;
|
|
281
292
|
const allCurrentLocationMatches = this.matchRoutes(currentLocation, {
|
|
282
293
|
_buildLocation: true
|
|
283
294
|
});
|
|
@@ -515,7 +526,8 @@ class RouterCore {
|
|
|
515
526
|
...rest,
|
|
516
527
|
_includeValidateSearch: true
|
|
517
528
|
});
|
|
518
|
-
|
|
529
|
+
this.pendingBuiltLocation = location;
|
|
530
|
+
const commitPromise = this.commitLocation({
|
|
519
531
|
...location,
|
|
520
532
|
viewTransition,
|
|
521
533
|
replace,
|
|
@@ -523,6 +535,12 @@ class RouterCore {
|
|
|
523
535
|
hashScrollIntoView,
|
|
524
536
|
ignoreBlocker
|
|
525
537
|
});
|
|
538
|
+
Promise.resolve().then(() => {
|
|
539
|
+
if (this.pendingBuiltLocation === location) {
|
|
540
|
+
this.pendingBuiltLocation = void 0;
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
return commitPromise;
|
|
526
544
|
};
|
|
527
545
|
this.navigate = ({ to, reloadDocument, href, ...rest }) => {
|
|
528
546
|
if (!reloadDocument && href) {
|