@tanstack/router-core 1.130.5 → 1.130.7
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 +9 -16
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +1 -1
- package/dist/esm/router.d.ts +1 -1
- package/dist/esm/router.js +9 -16
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +12 -21
package/dist/cjs/router.cjs
CHANGED
|
@@ -543,7 +543,7 @@ class RouterCore {
|
|
|
543
543
|
pendingMatches,
|
|
544
544
|
// If a cached moved to pendingMatches, remove it from cachedMatches
|
|
545
545
|
cachedMatches: s.cachedMatches.filter(
|
|
546
|
-
(d) => !pendingMatches.
|
|
546
|
+
(d) => !pendingMatches.some((e) => e.id === d.id)
|
|
547
547
|
)
|
|
548
548
|
}));
|
|
549
549
|
};
|
|
@@ -589,13 +589,13 @@ class RouterCore {
|
|
|
589
589
|
const previousMatches = s.matches;
|
|
590
590
|
const newMatches = s.pendingMatches || s.matches;
|
|
591
591
|
exitingMatches = previousMatches.filter(
|
|
592
|
-
(match) => !newMatches.
|
|
592
|
+
(match) => !newMatches.some((d) => d.id === match.id)
|
|
593
593
|
);
|
|
594
594
|
enteringMatches = newMatches.filter(
|
|
595
|
-
(match) => !previousMatches.
|
|
595
|
+
(match) => !previousMatches.some((d) => d.id === match.id)
|
|
596
596
|
);
|
|
597
597
|
stayingMatches = previousMatches.filter(
|
|
598
|
-
(match) => newMatches.
|
|
598
|
+
(match) => newMatches.some((d) => d.id === match.id)
|
|
599
599
|
);
|
|
600
600
|
return {
|
|
601
601
|
...s,
|
|
@@ -691,23 +691,16 @@ class RouterCore {
|
|
|
691
691
|
};
|
|
692
692
|
this.updateMatch = (id, updater) => {
|
|
693
693
|
var _a;
|
|
694
|
-
|
|
695
|
-
const isPending = (_a = this.state.pendingMatches) == null ? void 0 : _a.find((d) => d.id === id);
|
|
696
|
-
const isMatched = this.state.matches.find((d) => d.id === id);
|
|
697
|
-
const isCached = this.state.cachedMatches.find((d) => d.id === id);
|
|
698
|
-
const matchesKey = isPending ? "pendingMatches" : isMatched ? "matches" : isCached ? "cachedMatches" : "";
|
|
694
|
+
const matchesKey = ((_a = this.state.pendingMatches) == null ? void 0 : _a.some((d) => d.id === id)) ? "pendingMatches" : this.state.matches.some((d) => d.id === id) ? "matches" : this.state.cachedMatches.some((d) => d.id === id) ? "cachedMatches" : "";
|
|
699
695
|
if (matchesKey) {
|
|
700
696
|
this.__store.setState((s) => {
|
|
701
697
|
var _a2;
|
|
702
698
|
return {
|
|
703
699
|
...s,
|
|
704
|
-
[matchesKey]: (_a2 = s[matchesKey]) == null ? void 0 : _a2.map(
|
|
705
|
-
(d) => d.id === id ? updated = updater(d) : d
|
|
706
|
-
)
|
|
700
|
+
[matchesKey]: (_a2 = s[matchesKey]) == null ? void 0 : _a2.map((d) => d.id === id ? updater(d) : d)
|
|
707
701
|
};
|
|
708
702
|
});
|
|
709
703
|
}
|
|
710
|
-
return updated;
|
|
711
704
|
};
|
|
712
705
|
this.getMatch = (matchId) => {
|
|
713
706
|
var _a;
|
|
@@ -731,9 +724,9 @@ class RouterCore {
|
|
|
731
724
|
}
|
|
732
725
|
};
|
|
733
726
|
const resolvePreload = (matchId) => {
|
|
734
|
-
return !!(allPreload && !this.state.matches.
|
|
727
|
+
return !!(allPreload && !this.state.matches.some((d) => d.id === matchId));
|
|
735
728
|
};
|
|
736
|
-
if (!this.isServer && this.state.matches.
|
|
729
|
+
if (!this.isServer && this.state.matches.some((d) => d._forcePending)) {
|
|
737
730
|
triggerOnReady();
|
|
738
731
|
}
|
|
739
732
|
const handleRedirectAndNotFound = (match, err) => {
|
|
@@ -1083,7 +1076,7 @@ class RouterCore {
|
|
|
1083
1076
|
updateMatch(matchId, (prev) => ({
|
|
1084
1077
|
...prev,
|
|
1085
1078
|
loaderPromise: utils.createControlledPromise(),
|
|
1086
|
-
preload: !!preload && !this.state.matches.
|
|
1079
|
+
preload: !!preload && !this.state.matches.some((d) => d.id === matchId)
|
|
1087
1080
|
}));
|
|
1088
1081
|
const runLoader = async () => {
|
|
1089
1082
|
var _a2, _b2, _c2, _d2;
|