@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.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Store } from '@tanstack/store';
|
|
2
1
|
import { loadRouteChunk } from './load-matches.cjs';
|
|
2
|
+
import { Store } from '@tanstack/store';
|
|
3
3
|
import { LRUCache } from './lru-cache.cjs';
|
|
4
4
|
import { ProcessRouteTreeResult, ProcessedTree } from './new-process-route-tree.cjs';
|
|
5
5
|
import { SearchParser, SearchSerializer } from './searchParams.cjs';
|
package/dist/esm/router.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Store } from '@tanstack/store';
|
|
2
1
|
import { loadRouteChunk } from './load-matches.js';
|
|
2
|
+
import { Store } from '@tanstack/store';
|
|
3
3
|
import { LRUCache } from './lru-cache.js';
|
|
4
4
|
import { ProcessRouteTreeResult, ProcessedTree } from './new-process-route-tree.js';
|
|
5
5
|
import { SearchParser, SearchSerializer } from './searchParams.js';
|
package/dist/esm/router.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createStore } from "@tanstack/store";
|
|
2
2
|
import { createBrowserHistory, parseHref } from "@tanstack/history";
|
|
3
3
|
import { isServer } from "@tanstack/router-core/isServer";
|
|
4
4
|
import { batch } from "./utils/batch.js";
|
|
@@ -137,7 +137,7 @@ class RouterCore {
|
|
|
137
137
|
getInitialRouterState(this.latestLocation)
|
|
138
138
|
);
|
|
139
139
|
} else {
|
|
140
|
-
this.__store =
|
|
140
|
+
this.__store = createStore(getInitialRouterState(this.latestLocation));
|
|
141
141
|
setupScrollRestoration(this);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -729,8 +729,9 @@ class RouterCore {
|
|
|
729
729
|
this.startTransition(() => {
|
|
730
730
|
this.startViewTransition(async () => {
|
|
731
731
|
let exitingMatches = [];
|
|
732
|
-
let
|
|
733
|
-
let
|
|
732
|
+
let hookExitingMatches = [];
|
|
733
|
+
let hookEnteringMatches = [];
|
|
734
|
+
let hookStayingMatches = [];
|
|
734
735
|
batch(() => {
|
|
735
736
|
this.__store.setState((s) => {
|
|
736
737
|
const previousMatches = s.matches;
|
|
@@ -738,11 +739,18 @@ class RouterCore {
|
|
|
738
739
|
exitingMatches = previousMatches.filter(
|
|
739
740
|
(match) => !newMatches.some((d) => d.id === match.id)
|
|
740
741
|
);
|
|
741
|
-
|
|
742
|
-
(match) => !
|
|
742
|
+
hookExitingMatches = previousMatches.filter(
|
|
743
|
+
(match) => !newMatches.some((d) => d.routeId === match.routeId)
|
|
743
744
|
);
|
|
744
|
-
|
|
745
|
-
(match) => previousMatches.some(
|
|
745
|
+
hookEnteringMatches = newMatches.filter(
|
|
746
|
+
(match) => !previousMatches.some(
|
|
747
|
+
(d) => d.routeId === match.routeId
|
|
748
|
+
)
|
|
749
|
+
);
|
|
750
|
+
hookStayingMatches = newMatches.filter(
|
|
751
|
+
(match) => previousMatches.some(
|
|
752
|
+
(d) => d.routeId === match.routeId
|
|
753
|
+
)
|
|
746
754
|
);
|
|
747
755
|
return {
|
|
748
756
|
...s,
|
|
@@ -767,9 +775,9 @@ class RouterCore {
|
|
|
767
775
|
this.clearExpiredCache();
|
|
768
776
|
});
|
|
769
777
|
[
|
|
770
|
-
[
|
|
771
|
-
[
|
|
772
|
-
[
|
|
778
|
+
[hookExitingMatches, "onLeave"],
|
|
779
|
+
[hookEnteringMatches, "onEnter"],
|
|
780
|
+
[hookStayingMatches, "onStay"]
|
|
773
781
|
].forEach(([matches, hook]) => {
|
|
774
782
|
matches.forEach((match) => {
|
|
775
783
|
this.looseRoutesById[match.routeId].options[hook]?.(
|