@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.
@@ -4014,7 +4014,7 @@ var drawChart = (function (exports) {
4014
4014
  </script>
4015
4015
  <script>
4016
4016
  /*<!--*/
4017
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"c00e-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"c00e-61"},{"name":"react-router/src/index.tsx","uid":"c00e-63"}]}]}],"isRoot":true},"nodeParts":{"c00e-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"c00e-58"},"c00e-61":{"renderedLength":73815,"gzipLength":15405,"brotliLength":0,"mainUid":"c00e-60"},"c00e-63":{"renderedLength":11547,"gzipLength":3026,"brotliLength":0,"mainUid":"c00e-62"}},"nodeMetas":{"c00e-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"c00e-59"},"imported":[],"importedBy":[{"uid":"c00e-62"}]},"c00e-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"c00e-61"},"imported":[],"importedBy":[{"uid":"c00e-62"}]},"c00e-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"c00e-63"},"imported":[{"uid":"c00e-58"},{"uid":"c00e-64"},{"uid":"c00e-65"},{"uid":"c00e-60"},{"uid":"c00e-66"}],"importedBy":[],"isEntry":true},"c00e-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"c00e-62"}],"isExternal":true},"c00e-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"c00e-62"}],"isExternal":true},"c00e-66":{"id":"react-lazy-with-preload/lib/index","moduleParts":{},"imported":[],"importedBy":[{"uid":"c00e-62"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4017
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"45db-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"45db-61"},{"name":"react-router/src/index.tsx","uid":"45db-63"}]}]}],"isRoot":true},"nodeParts":{"45db-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"45db-58"},"45db-61":{"renderedLength":74071,"gzipLength":15445,"brotliLength":0,"mainUid":"45db-60"},"45db-63":{"renderedLength":11304,"gzipLength":2961,"brotliLength":0,"mainUid":"45db-62"}},"nodeMetas":{"45db-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"45db-59"},"imported":[],"importedBy":[{"uid":"45db-62"}]},"45db-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"45db-61"},"imported":[],"importedBy":[{"uid":"45db-62"}]},"45db-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"45db-63"},"imported":[{"uid":"45db-58"},{"uid":"45db-64"},{"uid":"45db-65"},{"uid":"45db-60"},{"uid":"45db-66"}],"importedBy":[],"isEntry":true},"45db-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"45db-62"}],"isExternal":true},"45db-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"45db-62"}],"isExternal":true},"45db-66":{"id":"react-lazy-with-preload/lib/index","moduleParts":{},"imported":[],"importedBy":[{"uid":"45db-62"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4018
4018
 
4019
4019
  const run = () => {
4020
4020
  const width = window.innerWidth;
@@ -7,7 +7,7 @@
7
7
  "name": "index.production.js",
8
8
  "children": [
9
9
  {
10
- "uid": "c00e-68",
10
+ "uid": "45db-68",
11
11
  "name": "\u0000rollupPluginBabelHelpers.js"
12
12
  },
13
13
  {
@@ -15,11 +15,11 @@
15
15
  "children": [
16
16
  {
17
17
  "name": "router-core/build/esm/index.js",
18
- "uid": "c00e-70"
18
+ "uid": "45db-70"
19
19
  },
20
20
  {
21
21
  "name": "react-router/src/index.tsx",
22
- "uid": "c00e-72"
22
+ "uid": "45db-72"
23
23
  }
24
24
  ]
25
25
  }
@@ -29,104 +29,104 @@
29
29
  "isRoot": true
30
30
  },
31
31
  "nodeParts": {
32
- "c00e-68": {
32
+ "45db-68": {
33
33
  "renderedLength": 798,
34
34
  "gzipLength": 366,
35
35
  "brotliLength": 0,
36
- "mainUid": "c00e-67"
36
+ "mainUid": "45db-67"
37
37
  },
38
- "c00e-70": {
39
- "renderedLength": 73815,
40
- "gzipLength": 15405,
38
+ "45db-70": {
39
+ "renderedLength": 74071,
40
+ "gzipLength": 15445,
41
41
  "brotliLength": 0,
42
- "mainUid": "c00e-69"
42
+ "mainUid": "45db-69"
43
43
  },
44
- "c00e-72": {
45
- "renderedLength": 11547,
46
- "gzipLength": 3026,
44
+ "45db-72": {
45
+ "renderedLength": 11304,
46
+ "gzipLength": 2961,
47
47
  "brotliLength": 0,
48
- "mainUid": "c00e-71"
48
+ "mainUid": "45db-71"
49
49
  }
50
50
  },
51
51
  "nodeMetas": {
52
- "c00e-67": {
52
+ "45db-67": {
53
53
  "id": "\u0000rollupPluginBabelHelpers.js",
54
54
  "moduleParts": {
55
- "index.production.js": "c00e-68"
55
+ "index.production.js": "45db-68"
56
56
  },
57
57
  "imported": [],
58
58
  "importedBy": [
59
59
  {
60
- "uid": "c00e-71"
60
+ "uid": "45db-71"
61
61
  }
62
62
  ]
63
63
  },
64
- "c00e-69": {
64
+ "45db-69": {
65
65
  "id": "/packages/router-core/build/esm/index.js",
66
66
  "moduleParts": {
67
- "index.production.js": "c00e-70"
67
+ "index.production.js": "45db-70"
68
68
  },
69
69
  "imported": [],
70
70
  "importedBy": [
71
71
  {
72
- "uid": "c00e-71"
72
+ "uid": "45db-71"
73
73
  }
74
74
  ]
75
75
  },
76
- "c00e-71": {
76
+ "45db-71": {
77
77
  "id": "/packages/react-router/src/index.tsx",
78
78
  "moduleParts": {
79
- "index.production.js": "c00e-72"
79
+ "index.production.js": "45db-72"
80
80
  },
81
81
  "imported": [
82
82
  {
83
- "uid": "c00e-67"
83
+ "uid": "45db-67"
84
84
  },
85
85
  {
86
- "uid": "c00e-73"
86
+ "uid": "45db-73"
87
87
  },
88
88
  {
89
- "uid": "c00e-74"
89
+ "uid": "45db-74"
90
90
  },
91
91
  {
92
- "uid": "c00e-69"
92
+ "uid": "45db-69"
93
93
  },
94
94
  {
95
- "uid": "c00e-75"
95
+ "uid": "45db-75"
96
96
  }
97
97
  ],
98
98
  "importedBy": [],
99
99
  "isEntry": true
100
100
  },
101
- "c00e-73": {
101
+ "45db-73": {
102
102
  "id": "react",
103
103
  "moduleParts": {},
104
104
  "imported": [],
105
105
  "importedBy": [
106
106
  {
107
- "uid": "c00e-71"
107
+ "uid": "45db-71"
108
108
  }
109
109
  ],
110
110
  "isExternal": true
111
111
  },
112
- "c00e-74": {
112
+ "45db-74": {
113
113
  "id": "use-sync-external-store/shim",
114
114
  "moduleParts": {},
115
115
  "imported": [],
116
116
  "importedBy": [
117
117
  {
118
- "uid": "c00e-71"
118
+ "uid": "45db-71"
119
119
  }
120
120
  ],
121
121
  "isExternal": true
122
122
  },
123
- "c00e-75": {
123
+ "45db-75": {
124
124
  "id": "react-lazy-with-preload/lib/index",
125
125
  "moduleParts": {},
126
126
  "imported": [],
127
127
  "importedBy": [
128
128
  {
129
- "uid": "c00e-71"
129
+ "uid": "45db-71"
130
130
  }
131
131
  ],
132
132
  "isExternal": true
@@ -1762,10 +1762,16 @@
1762
1762
  return router.routesById[id];
1763
1763
  },
1764
1764
  notify: () => {
1765
- router.state = _extends({}, router.state, {
1766
- isFetching: router.state.status === 'loading' || router.state.matches.some(d => d.isFetching),
1767
- isPreloading: Object.values(router.matchCache).some(d => d.match.isFetching && !router.state.matches.find(dd => dd.matchId === d.match.matchId))
1768
- });
1765
+ const isFetching = router.state.status === 'loading' || router.state.matches.some(d => d.isFetching);
1766
+ const isPreloading = Object.values(router.matchCache).some(d => d.match.isFetching && !router.state.matches.find(dd => dd.matchId === d.match.matchId));
1767
+
1768
+ if (router.state.isFetching !== isFetching || router.state.isPreloading !== isPreloading) {
1769
+ router.state = _extends({}, router.state, {
1770
+ isFetching,
1771
+ isPreloading
1772
+ });
1773
+ }
1774
+
1769
1775
  cascadeLoaderData(router.state.matches);
1770
1776
  router.listeners.forEach(listener => listener(router));
1771
1777
  },
@@ -1784,7 +1790,7 @@
1784
1790
  invariant(dehydratedMatch, 'Oh no! Dehydrated route matches did not match the active state of the router 😬');
1785
1791
  Object.assign(match, dehydratedMatch);
1786
1792
  });
1787
- router.loadMatches(matches);
1793
+ matches.forEach(match => match.__.validate());
1788
1794
  router.state = _extends({}, router.state, dehydratedState, {
1789
1795
  matches
1790
1796
  });
@@ -1800,8 +1806,11 @@
1800
1806
 
1801
1807
  if (next.href !== router.location.href) {
1802
1808
  router.__.commitLocation(next, true);
1803
- } // router.load()
1809
+ }
1804
1810
 
1811
+ if (!router.state.matches.length) {
1812
+ router.load();
1813
+ }
1805
1814
 
1806
1815
  const unsub = router.history.listen(event => {
1807
1816
  router.load(router.__.parseLocation(event.location, router.location));
@@ -2502,9 +2511,6 @@
2502
2511
  //
2503
2512
  const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
2504
2513
  const routerContext = /*#__PURE__*/React__namespace.createContext(null); // Detect if we're in the DOM
2505
-
2506
- const isDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
2507
- const useLayoutEffect = isDOM ? React__namespace.useLayoutEffect : React__namespace.useEffect;
2508
2514
  function MatchesProvider(props) {
2509
2515
  return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, props);
2510
2516
  }
@@ -2686,10 +2692,8 @@
2686
2692
 
2687
2693
  router.update(rest);
2688
2694
  useRouterSubscription(router);
2689
- useLayoutEffect(() => {
2690
- const unsub = router.mount();
2691
- router.load();
2692
- return unsub;
2695
+ React__namespace.useEffect(() => {
2696
+ return router.mount();
2693
2697
  }, [router]);
2694
2698
  return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
2695
2699
  value: {