@tanstack/react-router 0.0.1-beta.4 → 0.0.1-beta.5
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/build/cjs/router-core/build/esm/index.js +15 -7
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +15 -7
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +27 -27
- package/build/umd/index.development.js +15 -7
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -1770,7 +1770,6 @@ function createRouter(userOptions) {
|
|
|
1770
1770
|
matches: [],
|
|
1771
1771
|
actions: {},
|
|
1772
1772
|
loaders: {},
|
|
1773
|
-
loaderData: {},
|
|
1774
1773
|
lastUpdated: Date.now(),
|
|
1775
1774
|
isFetching: false,
|
|
1776
1775
|
isPreloading: false
|
|
@@ -1804,11 +1803,11 @@ function createRouter(userOptions) {
|
|
|
1804
1803
|
|
|
1805
1804
|
if (next.href !== router.location.href) {
|
|
1806
1805
|
router.__.commitLocation(next, true);
|
|
1807
|
-
} else {
|
|
1808
|
-
router.loadLocation();
|
|
1809
1806
|
}
|
|
1810
1807
|
|
|
1811
|
-
|
|
1808
|
+
router.loadLocation();
|
|
1809
|
+
const unsub = router.history.listen(event => {
|
|
1810
|
+
console.log(event.location);
|
|
1812
1811
|
router.loadLocation(router.__.parseLocation(event.location, router.location));
|
|
1813
1812
|
}); // addEventListener does not exist in React Native, but window does
|
|
1814
1813
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
@@ -1830,6 +1829,17 @@ function createRouter(userOptions) {
|
|
|
1830
1829
|
router.loadLocation();
|
|
1831
1830
|
},
|
|
1832
1831
|
update: opts => {
|
|
1832
|
+
const newHistory = (opts == null ? void 0 : opts.history) !== router.history;
|
|
1833
|
+
|
|
1834
|
+
if (!router.location || newHistory) {
|
|
1835
|
+
if (opts != null && opts.history) {
|
|
1836
|
+
router.history = opts.history;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
router.location = router.__.parseLocation(router.history.location);
|
|
1840
|
+
router.state.location = router.location;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1833
1843
|
Object.assign(router.options, opts);
|
|
1834
1844
|
const {
|
|
1835
1845
|
basepath,
|
|
@@ -1878,7 +1888,7 @@ function createRouter(userOptions) {
|
|
|
1878
1888
|
|
|
1879
1889
|
router.cancelMatches(); // Match the routes
|
|
1880
1890
|
|
|
1881
|
-
const matches = router.matchRoutes(location.pathname, {
|
|
1891
|
+
const matches = router.matchRoutes(router.location.pathname, {
|
|
1882
1892
|
strictParseParams: true
|
|
1883
1893
|
});
|
|
1884
1894
|
router.state = _extends({}, router.state, {
|
|
@@ -2480,8 +2490,6 @@ function createRouter(userOptions) {
|
|
|
2480
2490
|
}
|
|
2481
2491
|
}
|
|
2482
2492
|
};
|
|
2483
|
-
router.location = router.__.parseLocation(history.location);
|
|
2484
|
-
router.state.location = router.location;
|
|
2485
2493
|
router.update(userOptions); // Allow frameworks to hook into the router creation
|
|
2486
2494
|
|
|
2487
2495
|
router.options.createRouter == null ? void 0 : router.options.createRouter(router);
|