@tanstack/router-core 1.130.11 → 1.130.17
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 +10 -4
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +2 -1
- package/dist/esm/router.d.ts +2 -1
- package/dist/esm/router.js +10 -4
- package/dist/esm/router.js.map +1 -1
- package/package.json +2 -2
- package/src/router.ts +12 -5
package/dist/cjs/router.cjs
CHANGED
|
@@ -79,7 +79,7 @@ class RouterCore {
|
|
|
79
79
|
this.history = this.options.history ?? (this.isServer ? history.createMemoryHistory({
|
|
80
80
|
initialEntries: [this.basepath || "/"]
|
|
81
81
|
}) : history.createBrowserHistory());
|
|
82
|
-
this.
|
|
82
|
+
this.updateLatestLocation();
|
|
83
83
|
}
|
|
84
84
|
if (this.options.routeTree !== this.routeTree) {
|
|
85
85
|
this.routeTree = this.options.routeTree;
|
|
@@ -104,6 +104,12 @@ class RouterCore {
|
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
+
this.updateLatestLocation = () => {
|
|
108
|
+
this.latestLocation = this.parseLocation(
|
|
109
|
+
this.history.location,
|
|
110
|
+
this.latestLocation
|
|
111
|
+
);
|
|
112
|
+
};
|
|
107
113
|
this.buildRouteTree = () => {
|
|
108
114
|
const { routesById, routesByPath, flatRoutes } = processRouteTree({
|
|
109
115
|
routeTree: this.routeTree,
|
|
@@ -141,7 +147,7 @@ class RouterCore {
|
|
|
141
147
|
}
|
|
142
148
|
});
|
|
143
149
|
};
|
|
144
|
-
this.parseLocation = (
|
|
150
|
+
this.parseLocation = (locationToParse, previousLocation) => {
|
|
145
151
|
const parse = ({
|
|
146
152
|
pathname,
|
|
147
153
|
search,
|
|
@@ -159,7 +165,7 @@ class RouterCore {
|
|
|
159
165
|
state: utils.replaceEqualDeep(previousLocation == null ? void 0 : previousLocation.state, state)
|
|
160
166
|
};
|
|
161
167
|
};
|
|
162
|
-
const location = parse(locationToParse
|
|
168
|
+
const location = parse(locationToParse);
|
|
163
169
|
const { __tempLocation, __tempKey } = location.state;
|
|
164
170
|
if (__tempLocation && (!__tempKey || __tempKey === this.tempLocationKey)) {
|
|
165
171
|
const parsedTempLocation = parse(__tempLocation);
|
|
@@ -512,7 +518,7 @@ class RouterCore {
|
|
|
512
518
|
};
|
|
513
519
|
this.beforeLoad = () => {
|
|
514
520
|
this.cancelMatches();
|
|
515
|
-
this.
|
|
521
|
+
this.updateLatestLocation();
|
|
516
522
|
if (this.isServer) {
|
|
517
523
|
const nextLocation = this.buildLocation({
|
|
518
524
|
to: this.latestLocation.pathname,
|