@tanstack/react-router 0.0.1-beta.13 → 0.0.1-beta.15
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 +22 -7
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +24 -14
- 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 +24 -14
- 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/stats-html.html
CHANGED
|
@@ -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":"
|
|
4017
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"c8b3-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"c8b3-61"},{"name":"react-router/src/index.tsx","uid":"c8b3-63"}]}]}],"isRoot":true},"nodeParts":{"c8b3-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"c8b3-58"},"c8b3-61":{"renderedLength":74380,"gzipLength":15496,"brotliLength":0,"mainUid":"c8b3-60"},"c8b3-63":{"renderedLength":11304,"gzipLength":2961,"brotliLength":0,"mainUid":"c8b3-62"}},"nodeMetas":{"c8b3-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"c8b3-59"},"imported":[],"importedBy":[{"uid":"c8b3-62"}]},"c8b3-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"c8b3-61"},"imported":[],"importedBy":[{"uid":"c8b3-62"}]},"c8b3-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"c8b3-63"},"imported":[{"uid":"c8b3-58"},{"uid":"c8b3-64"},{"uid":"c8b3-65"},{"uid":"c8b3-60"},{"uid":"c8b3-66"}],"importedBy":[],"isEntry":true},"c8b3-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"c8b3-62"}],"isExternal":true},"c8b3-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"c8b3-62"}],"isExternal":true},"c8b3-66":{"id":"react-lazy-with-preload/lib/index","moduleParts":{},"imported":[],"importedBy":[{"uid":"c8b3-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;
|
package/build/stats-react.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"name": "index.production.js",
|
|
8
8
|
"children": [
|
|
9
9
|
{
|
|
10
|
-
"uid": "
|
|
10
|
+
"uid": "c8b3-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": "
|
|
18
|
+
"uid": "c8b3-70"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "react-router/src/index.tsx",
|
|
22
|
-
"uid": "
|
|
22
|
+
"uid": "c8b3-72"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -29,104 +29,104 @@
|
|
|
29
29
|
"isRoot": true
|
|
30
30
|
},
|
|
31
31
|
"nodeParts": {
|
|
32
|
-
"
|
|
32
|
+
"c8b3-68": {
|
|
33
33
|
"renderedLength": 798,
|
|
34
34
|
"gzipLength": 366,
|
|
35
35
|
"brotliLength": 0,
|
|
36
|
-
"mainUid": "
|
|
36
|
+
"mainUid": "c8b3-67"
|
|
37
37
|
},
|
|
38
|
-
"
|
|
39
|
-
"renderedLength":
|
|
40
|
-
"gzipLength":
|
|
38
|
+
"c8b3-70": {
|
|
39
|
+
"renderedLength": 74380,
|
|
40
|
+
"gzipLength": 15496,
|
|
41
41
|
"brotliLength": 0,
|
|
42
|
-
"mainUid": "
|
|
42
|
+
"mainUid": "c8b3-69"
|
|
43
43
|
},
|
|
44
|
-
"
|
|
45
|
-
"renderedLength":
|
|
46
|
-
"gzipLength":
|
|
44
|
+
"c8b3-72": {
|
|
45
|
+
"renderedLength": 11304,
|
|
46
|
+
"gzipLength": 2961,
|
|
47
47
|
"brotliLength": 0,
|
|
48
|
-
"mainUid": "
|
|
48
|
+
"mainUid": "c8b3-71"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"nodeMetas": {
|
|
52
|
-
"
|
|
52
|
+
"c8b3-67": {
|
|
53
53
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
54
54
|
"moduleParts": {
|
|
55
|
-
"index.production.js": "
|
|
55
|
+
"index.production.js": "c8b3-68"
|
|
56
56
|
},
|
|
57
57
|
"imported": [],
|
|
58
58
|
"importedBy": [
|
|
59
59
|
{
|
|
60
|
-
"uid": "
|
|
60
|
+
"uid": "c8b3-71"
|
|
61
61
|
}
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"
|
|
64
|
+
"c8b3-69": {
|
|
65
65
|
"id": "/packages/router-core/build/esm/index.js",
|
|
66
66
|
"moduleParts": {
|
|
67
|
-
"index.production.js": "
|
|
67
|
+
"index.production.js": "c8b3-70"
|
|
68
68
|
},
|
|
69
69
|
"imported": [],
|
|
70
70
|
"importedBy": [
|
|
71
71
|
{
|
|
72
|
-
"uid": "
|
|
72
|
+
"uid": "c8b3-71"
|
|
73
73
|
}
|
|
74
74
|
]
|
|
75
75
|
},
|
|
76
|
-
"
|
|
76
|
+
"c8b3-71": {
|
|
77
77
|
"id": "/packages/react-router/src/index.tsx",
|
|
78
78
|
"moduleParts": {
|
|
79
|
-
"index.production.js": "
|
|
79
|
+
"index.production.js": "c8b3-72"
|
|
80
80
|
},
|
|
81
81
|
"imported": [
|
|
82
82
|
{
|
|
83
|
-
"uid": "
|
|
83
|
+
"uid": "c8b3-67"
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
"uid": "
|
|
86
|
+
"uid": "c8b3-73"
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
|
-
"uid": "
|
|
89
|
+
"uid": "c8b3-74"
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
"uid": "
|
|
92
|
+
"uid": "c8b3-69"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
|
-
"uid": "
|
|
95
|
+
"uid": "c8b3-75"
|
|
96
96
|
}
|
|
97
97
|
],
|
|
98
98
|
"importedBy": [],
|
|
99
99
|
"isEntry": true
|
|
100
100
|
},
|
|
101
|
-
"
|
|
101
|
+
"c8b3-73": {
|
|
102
102
|
"id": "react",
|
|
103
103
|
"moduleParts": {},
|
|
104
104
|
"imported": [],
|
|
105
105
|
"importedBy": [
|
|
106
106
|
{
|
|
107
|
-
"uid": "
|
|
107
|
+
"uid": "c8b3-71"
|
|
108
108
|
}
|
|
109
109
|
],
|
|
110
110
|
"isExternal": true
|
|
111
111
|
},
|
|
112
|
-
"
|
|
112
|
+
"c8b3-74": {
|
|
113
113
|
"id": "use-sync-external-store/shim",
|
|
114
114
|
"moduleParts": {},
|
|
115
115
|
"imported": [],
|
|
116
116
|
"importedBy": [
|
|
117
117
|
{
|
|
118
|
-
"uid": "
|
|
118
|
+
"uid": "c8b3-71"
|
|
119
119
|
}
|
|
120
120
|
],
|
|
121
121
|
"isExternal": true
|
|
122
122
|
},
|
|
123
|
-
"
|
|
123
|
+
"c8b3-75": {
|
|
124
124
|
"id": "react-lazy-with-preload/lib/index",
|
|
125
125
|
"moduleParts": {},
|
|
126
126
|
"imported": [],
|
|
127
127
|
"importedBy": [
|
|
128
128
|
{
|
|
129
|
-
"uid": "
|
|
129
|
+
"uid": "c8b3-71"
|
|
130
130
|
}
|
|
131
131
|
],
|
|
132
132
|
"isExternal": true
|
|
@@ -1585,7 +1585,10 @@
|
|
|
1585
1585
|
var _ref, _ref2, _opts$maxAge;
|
|
1586
1586
|
|
|
1587
1587
|
if (routeMatch.options.loader) {
|
|
1588
|
+
var _routeMatch$parentMat3;
|
|
1589
|
+
|
|
1588
1590
|
const data = await routeMatch.options.loader({
|
|
1591
|
+
parentLoaderPromise: (_routeMatch$parentMat3 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat3.__.dataPromise,
|
|
1589
1592
|
params: routeMatch.params,
|
|
1590
1593
|
search: routeMatch.routeSearch,
|
|
1591
1594
|
signal: routeMatch.__.abortController.signal
|
|
@@ -1602,6 +1605,7 @@
|
|
|
1602
1605
|
routeMatch.status = 'success';
|
|
1603
1606
|
routeMatch.updatedAt = Date.now();
|
|
1604
1607
|
routeMatch.invalidAt = routeMatch.updatedAt + ((_ref = (_ref2 = (_opts$maxAge = opts == null ? void 0 : opts.maxAge) != null ? _opts$maxAge : routeMatch.options.loaderMaxAge) != null ? _ref2 : router.options.defaultLoaderMaxAge) != null ? _ref : 0);
|
|
1608
|
+
return routeMatch.routeLoaderData;
|
|
1605
1609
|
} catch (err) {
|
|
1606
1610
|
if (id !== routeMatch.__.latestId) {
|
|
1607
1611
|
return routeMatch.__.loadPromise;
|
|
@@ -1614,11 +1618,12 @@
|
|
|
1614
1618
|
routeMatch.error = err;
|
|
1615
1619
|
routeMatch.status = 'error';
|
|
1616
1620
|
routeMatch.updatedAt = Date.now();
|
|
1621
|
+
throw err;
|
|
1617
1622
|
}
|
|
1618
1623
|
});
|
|
1619
1624
|
|
|
1620
1625
|
try {
|
|
1621
|
-
await Promise.all([routeMatch.__.componentsPromise, routeMatch.__.dataPromise]);
|
|
1626
|
+
await Promise.all([routeMatch.__.componentsPromise, routeMatch.__.dataPromise.catch(() => {})]);
|
|
1622
1627
|
|
|
1623
1628
|
if (id !== routeMatch.__.latestId) {
|
|
1624
1629
|
return routeMatch.__.loadPromise;
|
|
@@ -1762,10 +1767,16 @@
|
|
|
1762
1767
|
return router.routesById[id];
|
|
1763
1768
|
},
|
|
1764
1769
|
notify: () => {
|
|
1765
|
-
router.state
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1770
|
+
const isFetching = router.state.status === 'loading' || router.state.matches.some(d => d.isFetching);
|
|
1771
|
+
const isPreloading = Object.values(router.matchCache).some(d => d.match.isFetching && !router.state.matches.find(dd => dd.matchId === d.match.matchId));
|
|
1772
|
+
|
|
1773
|
+
if (router.state.isFetching !== isFetching || router.state.isPreloading !== isPreloading) {
|
|
1774
|
+
router.state = _extends({}, router.state, {
|
|
1775
|
+
isFetching,
|
|
1776
|
+
isPreloading
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1769
1780
|
cascadeLoaderData(router.state.matches);
|
|
1770
1781
|
router.listeners.forEach(listener => listener(router));
|
|
1771
1782
|
},
|
|
@@ -1784,7 +1795,7 @@
|
|
|
1784
1795
|
invariant(dehydratedMatch, 'Oh no! Dehydrated route matches did not match the active state of the router 😬');
|
|
1785
1796
|
Object.assign(match, dehydratedMatch);
|
|
1786
1797
|
});
|
|
1787
|
-
|
|
1798
|
+
matches.forEach(match => match.__.validate());
|
|
1788
1799
|
router.state = _extends({}, router.state, dehydratedState, {
|
|
1789
1800
|
matches
|
|
1790
1801
|
});
|
|
@@ -1800,8 +1811,11 @@
|
|
|
1800
1811
|
|
|
1801
1812
|
if (next.href !== router.location.href) {
|
|
1802
1813
|
router.__.commitLocation(next, true);
|
|
1803
|
-
}
|
|
1814
|
+
}
|
|
1804
1815
|
|
|
1816
|
+
if (!router.state.matches.length) {
|
|
1817
|
+
router.load();
|
|
1818
|
+
}
|
|
1805
1819
|
|
|
1806
1820
|
const unsub = router.history.listen(event => {
|
|
1807
1821
|
router.load(router.__.parseLocation(event.location, router.location));
|
|
@@ -2091,6 +2105,7 @@
|
|
|
2091
2105
|
const interpolatedPath = interpolatePath(foundRoute.routePath, params);
|
|
2092
2106
|
const matchId = interpolatePath(foundRoute.routeId, params, true);
|
|
2093
2107
|
const match = existingMatches.find(d => d.matchId === matchId) || ((_router$matchCache$ma = router.matchCache[matchId]) == null ? void 0 : _router$matchCache$ma.match) || createRouteMatch(router, foundRoute, {
|
|
2108
|
+
parentMatch,
|
|
2094
2109
|
matchId,
|
|
2095
2110
|
params,
|
|
2096
2111
|
pathname: joinPaths([pathname, interpolatedPath])
|
|
@@ -2502,9 +2517,6 @@
|
|
|
2502
2517
|
//
|
|
2503
2518
|
const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
2504
2519
|
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
2520
|
function MatchesProvider(props) {
|
|
2509
2521
|
return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, props);
|
|
2510
2522
|
}
|
|
@@ -2686,10 +2698,8 @@
|
|
|
2686
2698
|
|
|
2687
2699
|
router.update(rest);
|
|
2688
2700
|
useRouterSubscription(router);
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
router.load();
|
|
2692
|
-
return unsub;
|
|
2701
|
+
React__namespace.useEffect(() => {
|
|
2702
|
+
return router.mount();
|
|
2693
2703
|
}, [router]);
|
|
2694
2704
|
return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
|
|
2695
2705
|
value: {
|