@tanstack/react-router 0.0.1-beta.26 → 0.0.1-beta.28
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 +45 -10
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/esm/index.js +45 -10
- 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 +45 -10
- 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 +1 -1
- package/src/index.tsx +55 -8
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":"9975-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"9975-61"},{"name":"react-router/src/index.tsx","uid":"9975-63"}]}]}],"isRoot":true},"nodeParts":{"9975-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"9975-58"},"9975-61":{"renderedLength":75287,"gzipLength":15783,"brotliLength":0,"mainUid":"9975-60"},"9975-63":{"renderedLength":14382,"gzipLength":3575,"brotliLength":0,"mainUid":"9975-62"}},"nodeMetas":{"9975-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"9975-59"},"imported":[],"importedBy":[{"uid":"9975-62"}]},"9975-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"9975-61"},"imported":[],"importedBy":[{"uid":"9975-62"}]},"9975-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"9975-63"},"imported":[{"uid":"9975-58"},{"uid":"9975-64"},{"uid":"9975-65"},{"uid":"9975-60"}],"importedBy":[],"isEntry":true},"9975-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"9975-62"}],"isExternal":true},"9975-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"9975-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": "9975-67",
|
|
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": "9975-69"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "react-router/src/index.tsx",
|
|
22
|
-
"uid": "
|
|
22
|
+
"uid": "9975-71"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -29,90 +29,90 @@
|
|
|
29
29
|
"isRoot": true
|
|
30
30
|
},
|
|
31
31
|
"nodeParts": {
|
|
32
|
-
"
|
|
32
|
+
"9975-67": {
|
|
33
33
|
"renderedLength": 798,
|
|
34
34
|
"gzipLength": 366,
|
|
35
35
|
"brotliLength": 0,
|
|
36
|
-
"mainUid": "
|
|
36
|
+
"mainUid": "9975-66"
|
|
37
37
|
},
|
|
38
|
-
"
|
|
38
|
+
"9975-69": {
|
|
39
39
|
"renderedLength": 75287,
|
|
40
40
|
"gzipLength": 15783,
|
|
41
41
|
"brotliLength": 0,
|
|
42
|
-
"mainUid": "
|
|
42
|
+
"mainUid": "9975-68"
|
|
43
43
|
},
|
|
44
|
-
"
|
|
45
|
-
"renderedLength":
|
|
46
|
-
"gzipLength":
|
|
44
|
+
"9975-71": {
|
|
45
|
+
"renderedLength": 14382,
|
|
46
|
+
"gzipLength": 3575,
|
|
47
47
|
"brotliLength": 0,
|
|
48
|
-
"mainUid": "
|
|
48
|
+
"mainUid": "9975-70"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"nodeMetas": {
|
|
52
|
-
"
|
|
52
|
+
"9975-66": {
|
|
53
53
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
54
54
|
"moduleParts": {
|
|
55
|
-
"index.production.js": "
|
|
55
|
+
"index.production.js": "9975-67"
|
|
56
56
|
},
|
|
57
57
|
"imported": [],
|
|
58
58
|
"importedBy": [
|
|
59
59
|
{
|
|
60
|
-
"uid": "
|
|
60
|
+
"uid": "9975-70"
|
|
61
61
|
}
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"
|
|
64
|
+
"9975-68": {
|
|
65
65
|
"id": "/packages/router-core/build/esm/index.js",
|
|
66
66
|
"moduleParts": {
|
|
67
|
-
"index.production.js": "
|
|
67
|
+
"index.production.js": "9975-69"
|
|
68
68
|
},
|
|
69
69
|
"imported": [],
|
|
70
70
|
"importedBy": [
|
|
71
71
|
{
|
|
72
|
-
"uid": "
|
|
72
|
+
"uid": "9975-70"
|
|
73
73
|
}
|
|
74
74
|
]
|
|
75
75
|
},
|
|
76
|
-
"
|
|
76
|
+
"9975-70": {
|
|
77
77
|
"id": "/packages/react-router/src/index.tsx",
|
|
78
78
|
"moduleParts": {
|
|
79
|
-
"index.production.js": "
|
|
79
|
+
"index.production.js": "9975-71"
|
|
80
80
|
},
|
|
81
81
|
"imported": [
|
|
82
82
|
{
|
|
83
|
-
"uid": "
|
|
83
|
+
"uid": "9975-66"
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
"uid": "
|
|
86
|
+
"uid": "9975-72"
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
|
-
"uid": "
|
|
89
|
+
"uid": "9975-73"
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
"uid": "
|
|
92
|
+
"uid": "9975-68"
|
|
93
93
|
}
|
|
94
94
|
],
|
|
95
95
|
"importedBy": [],
|
|
96
96
|
"isEntry": true
|
|
97
97
|
},
|
|
98
|
-
"
|
|
98
|
+
"9975-72": {
|
|
99
99
|
"id": "react",
|
|
100
100
|
"moduleParts": {},
|
|
101
101
|
"imported": [],
|
|
102
102
|
"importedBy": [
|
|
103
103
|
{
|
|
104
|
-
"uid": "
|
|
104
|
+
"uid": "9975-70"
|
|
105
105
|
}
|
|
106
106
|
],
|
|
107
107
|
"isExternal": true
|
|
108
108
|
},
|
|
109
|
-
"
|
|
109
|
+
"9975-73": {
|
|
110
110
|
"id": "use-sync-external-store/shim",
|
|
111
111
|
"moduleParts": {},
|
|
112
112
|
"imported": [],
|
|
113
113
|
"importedBy": [
|
|
114
114
|
{
|
|
115
|
-
"uid": "
|
|
115
|
+
"uid": "9975-70"
|
|
116
116
|
}
|
|
117
117
|
],
|
|
118
118
|
"isExternal": true
|
|
@@ -2643,9 +2643,10 @@
|
|
|
2643
2643
|
} = linkInfo;
|
|
2644
2644
|
|
|
2645
2645
|
const reactHandleClick = e => {
|
|
2646
|
-
React__namespace.startTransition
|
|
2647
|
-
|
|
2648
|
-
|
|
2646
|
+
if (React__namespace.startTransition) // This is a hack for react < 18
|
|
2647
|
+
React__namespace.startTransition(() => {
|
|
2648
|
+
handleClick(e);
|
|
2649
|
+
});else handleClick(e);
|
|
2649
2650
|
};
|
|
2650
2651
|
|
|
2651
2652
|
const composeHandlers = handlers => e => {
|
|
@@ -2830,7 +2831,8 @@
|
|
|
2830
2831
|
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
2831
2832
|
fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, null)
|
|
2832
2833
|
}, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
|
|
2833
|
-
errorComponent: errorComponent
|
|
2834
|
+
errorComponent: errorComponent,
|
|
2835
|
+
key: match.routeId
|
|
2834
2836
|
}, (() => {
|
|
2835
2837
|
if (match.status === 'error') {
|
|
2836
2838
|
throw match.error;
|
|
@@ -2850,7 +2852,8 @@
|
|
|
2850
2852
|
constructor() {
|
|
2851
2853
|
super(...arguments);
|
|
2852
2854
|
this.state = {
|
|
2853
|
-
error: false
|
|
2855
|
+
error: false,
|
|
2856
|
+
info: undefined
|
|
2854
2857
|
};
|
|
2855
2858
|
}
|
|
2856
2859
|
|
|
@@ -2863,17 +2866,49 @@
|
|
|
2863
2866
|
}
|
|
2864
2867
|
|
|
2865
2868
|
render() {
|
|
2866
|
-
|
|
2869
|
+
return /*#__PURE__*/React__namespace.createElement(CatchBoundaryInner, _extends$2({}, this.props, {
|
|
2870
|
+
errorState: this.state,
|
|
2871
|
+
reset: () => this.setState({})
|
|
2872
|
+
}));
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
} // This is the messiest thing ever... I'm either seriously tired (likely) or
|
|
2876
|
+
// there has to be a better way to reset error boundaries when the
|
|
2877
|
+
// router's location key changes.
|
|
2867
2878
|
|
|
2868
|
-
const errorComponent = (_this$props$errorComp = this.props.errorComponent) != null ? _this$props$errorComp : DefaultErrorBoundary;
|
|
2869
2879
|
|
|
2870
|
-
|
|
2871
|
-
|
|
2880
|
+
function CatchBoundaryInner(props) {
|
|
2881
|
+
var _props$errorComponent;
|
|
2882
|
+
|
|
2883
|
+
const [activeErrorState, setActiveErrorState] = React__namespace.useState(props.errorState);
|
|
2884
|
+
const router = useRouter();
|
|
2885
|
+
const errorComponent = (_props$errorComponent = props.errorComponent) != null ? _props$errorComponent : DefaultErrorBoundary;
|
|
2886
|
+
React__namespace.useEffect(() => {
|
|
2887
|
+
if (activeErrorState) {
|
|
2888
|
+
let prevKey = router.state.location.key;
|
|
2889
|
+
return router.subscribe(() => {
|
|
2890
|
+
if (router.state.location.key !== prevKey) {
|
|
2891
|
+
prevKey = router.state.location.key;
|
|
2892
|
+
setActiveErrorState({});
|
|
2893
|
+
}
|
|
2894
|
+
});
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
return;
|
|
2898
|
+
}, [activeErrorState]);
|
|
2899
|
+
React__namespace.useEffect(() => {
|
|
2900
|
+
if (props.errorState.error) {
|
|
2901
|
+
setActiveErrorState(props.errorState);
|
|
2872
2902
|
}
|
|
2873
2903
|
|
|
2874
|
-
|
|
2904
|
+
props.reset();
|
|
2905
|
+
}, [props.errorState.error]);
|
|
2906
|
+
|
|
2907
|
+
if (activeErrorState.error) {
|
|
2908
|
+
return /*#__PURE__*/React__namespace.createElement(errorComponent, activeErrorState);
|
|
2875
2909
|
}
|
|
2876
2910
|
|
|
2911
|
+
return props.children;
|
|
2877
2912
|
}
|
|
2878
2913
|
|
|
2879
2914
|
function DefaultErrorBoundary(_ref6) {
|