@tanstack/react-router 0.0.1-beta.13 → 0.0.1-beta.14
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/react-router/src/index.js +2 -7
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/cjs/router-core/build/esm/index.js +15 -6
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +17 -13
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +32 -32
- package/build/umd/index.development.js +17 -13
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +2 -4
package/build/esm/index.js
CHANGED
|
@@ -1747,10 +1747,16 @@ function createRouter(userOptions) {
|
|
|
1747
1747
|
return router.routesById[id];
|
|
1748
1748
|
},
|
|
1749
1749
|
notify: () => {
|
|
1750
|
-
router.state
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1750
|
+
const isFetching = router.state.status === 'loading' || router.state.matches.some(d => d.isFetching);
|
|
1751
|
+
const isPreloading = Object.values(router.matchCache).some(d => d.match.isFetching && !router.state.matches.find(dd => dd.matchId === d.match.matchId));
|
|
1752
|
+
|
|
1753
|
+
if (router.state.isFetching !== isFetching || router.state.isPreloading !== isPreloading) {
|
|
1754
|
+
router.state = _extends({}, router.state, {
|
|
1755
|
+
isFetching,
|
|
1756
|
+
isPreloading
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1754
1760
|
cascadeLoaderData(router.state.matches);
|
|
1755
1761
|
router.listeners.forEach(listener => listener(router));
|
|
1756
1762
|
},
|
|
@@ -1769,7 +1775,7 @@ function createRouter(userOptions) {
|
|
|
1769
1775
|
invariant(dehydratedMatch, 'Oh no! Dehydrated route matches did not match the active state of the router 😬');
|
|
1770
1776
|
Object.assign(match, dehydratedMatch);
|
|
1771
1777
|
});
|
|
1772
|
-
|
|
1778
|
+
matches.forEach(match => match.__.validate());
|
|
1773
1779
|
router.state = _extends({}, router.state, dehydratedState, {
|
|
1774
1780
|
matches
|
|
1775
1781
|
});
|
|
@@ -1785,8 +1791,11 @@ function createRouter(userOptions) {
|
|
|
1785
1791
|
|
|
1786
1792
|
if (next.href !== router.location.href) {
|
|
1787
1793
|
router.__.commitLocation(next, true);
|
|
1788
|
-
}
|
|
1794
|
+
}
|
|
1789
1795
|
|
|
1796
|
+
if (!router.state.matches.length) {
|
|
1797
|
+
router.load();
|
|
1798
|
+
}
|
|
1790
1799
|
|
|
1791
1800
|
const unsub = router.history.listen(event => {
|
|
1792
1801
|
router.load(router.__.parseLocation(event.location, router.location));
|
|
@@ -2487,9 +2496,6 @@ const _excluded = ["type", "children", "target", "activeProps", "inactiveProps",
|
|
|
2487
2496
|
//
|
|
2488
2497
|
const matchesContext = /*#__PURE__*/React.createContext(null);
|
|
2489
2498
|
const routerContext = /*#__PURE__*/React.createContext(null); // Detect if we're in the DOM
|
|
2490
|
-
|
|
2491
|
-
const isDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
2492
|
-
const useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect;
|
|
2493
2499
|
function MatchesProvider(props) {
|
|
2494
2500
|
return /*#__PURE__*/React.createElement(matchesContext.Provider, props);
|
|
2495
2501
|
}
|
|
@@ -2671,10 +2677,8 @@ function RouterProvider(_ref2) {
|
|
|
2671
2677
|
|
|
2672
2678
|
router.update(rest);
|
|
2673
2679
|
useRouterSubscription(router);
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
router.load();
|
|
2677
|
-
return unsub;
|
|
2680
|
+
React.useEffect(() => {
|
|
2681
|
+
return router.mount();
|
|
2678
2682
|
}, [router]);
|
|
2679
2683
|
return /*#__PURE__*/React.createElement(routerContext.Provider, {
|
|
2680
2684
|
value: {
|