@tanstack/router-core 1.162.9 → 1.163.3
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 +18 -10
- 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 +19 -11
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/router.ts +29 -11
package/dist/cjs/router.cjs
CHANGED
|
@@ -139,7 +139,7 @@ class RouterCore {
|
|
|
139
139
|
getInitialRouterState(this.latestLocation)
|
|
140
140
|
);
|
|
141
141
|
} else {
|
|
142
|
-
this.__store =
|
|
142
|
+
this.__store = store.createStore(getInitialRouterState(this.latestLocation));
|
|
143
143
|
scrollRestoration.setupScrollRestoration(this);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -731,8 +731,9 @@ class RouterCore {
|
|
|
731
731
|
this.startTransition(() => {
|
|
732
732
|
this.startViewTransition(async () => {
|
|
733
733
|
let exitingMatches = [];
|
|
734
|
-
let
|
|
735
|
-
let
|
|
734
|
+
let hookExitingMatches = [];
|
|
735
|
+
let hookEnteringMatches = [];
|
|
736
|
+
let hookStayingMatches = [];
|
|
736
737
|
batch.batch(() => {
|
|
737
738
|
this.__store.setState((s) => {
|
|
738
739
|
const previousMatches = s.matches;
|
|
@@ -740,11 +741,18 @@ class RouterCore {
|
|
|
740
741
|
exitingMatches = previousMatches.filter(
|
|
741
742
|
(match) => !newMatches.some((d) => d.id === match.id)
|
|
742
743
|
);
|
|
743
|
-
|
|
744
|
-
(match) => !
|
|
744
|
+
hookExitingMatches = previousMatches.filter(
|
|
745
|
+
(match) => !newMatches.some((d) => d.routeId === match.routeId)
|
|
745
746
|
);
|
|
746
|
-
|
|
747
|
-
(match) => previousMatches.some(
|
|
747
|
+
hookEnteringMatches = newMatches.filter(
|
|
748
|
+
(match) => !previousMatches.some(
|
|
749
|
+
(d) => d.routeId === match.routeId
|
|
750
|
+
)
|
|
751
|
+
);
|
|
752
|
+
hookStayingMatches = newMatches.filter(
|
|
753
|
+
(match) => previousMatches.some(
|
|
754
|
+
(d) => d.routeId === match.routeId
|
|
755
|
+
)
|
|
748
756
|
);
|
|
749
757
|
return {
|
|
750
758
|
...s,
|
|
@@ -769,9 +777,9 @@ class RouterCore {
|
|
|
769
777
|
this.clearExpiredCache();
|
|
770
778
|
});
|
|
771
779
|
[
|
|
772
|
-
[
|
|
773
|
-
[
|
|
774
|
-
[
|
|
780
|
+
[hookExitingMatches, "onLeave"],
|
|
781
|
+
[hookEnteringMatches, "onEnter"],
|
|
782
|
+
[hookStayingMatches, "onStay"]
|
|
775
783
|
].forEach(([matches, hook]) => {
|
|
776
784
|
matches.forEach((match) => {
|
|
777
785
|
this.looseRoutesById[match.routeId].options[hook]?.(
|