@tanstack/react-router 0.0.1-beta.25 → 0.0.1-beta.27
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 +41 -7
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/cjs/router-core/build/esm/index.js +6 -4
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +47 -11
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +29 -29
- package/build/types/index.d.ts +1 -1
- package/build/umd/index.development.js +47 -11
- 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 +52 -5
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":"287d-59","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"287d-61"},{"name":"react-router/src/index.tsx","uid":"287d-63"}]}]}],"isRoot":true},"nodeParts":{"287d-59":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"287d-58"},"287d-61":{"renderedLength":75287,"gzipLength":15783,"brotliLength":0,"mainUid":"287d-60"},"287d-63":{"renderedLength":14273,"gzipLength":3542,"brotliLength":0,"mainUid":"287d-62"}},"nodeMetas":{"287d-58":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"287d-59"},"imported":[],"importedBy":[{"uid":"287d-62"}]},"287d-60":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"287d-61"},"imported":[],"importedBy":[{"uid":"287d-62"}]},"287d-62":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"287d-63"},"imported":[{"uid":"287d-58"},{"uid":"287d-64"},{"uid":"287d-65"},{"uid":"287d-60"}],"importedBy":[],"isEntry":true},"287d-64":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"287d-62"}],"isExternal":true},"287d-65":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"287d-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": "287d-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": "287d-69"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "react-router/src/index.tsx",
|
|
22
|
-
"uid": "
|
|
22
|
+
"uid": "287d-71"
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -29,90 +29,90 @@
|
|
|
29
29
|
"isRoot": true
|
|
30
30
|
},
|
|
31
31
|
"nodeParts": {
|
|
32
|
-
"
|
|
32
|
+
"287d-67": {
|
|
33
33
|
"renderedLength": 798,
|
|
34
34
|
"gzipLength": 366,
|
|
35
35
|
"brotliLength": 0,
|
|
36
|
-
"mainUid": "
|
|
36
|
+
"mainUid": "287d-66"
|
|
37
37
|
},
|
|
38
|
-
"
|
|
39
|
-
"renderedLength":
|
|
40
|
-
"gzipLength":
|
|
38
|
+
"287d-69": {
|
|
39
|
+
"renderedLength": 75287,
|
|
40
|
+
"gzipLength": 15783,
|
|
41
41
|
"brotliLength": 0,
|
|
42
|
-
"mainUid": "
|
|
42
|
+
"mainUid": "287d-68"
|
|
43
43
|
},
|
|
44
|
-
"
|
|
45
|
-
"renderedLength":
|
|
46
|
-
"gzipLength":
|
|
44
|
+
"287d-71": {
|
|
45
|
+
"renderedLength": 14273,
|
|
46
|
+
"gzipLength": 3542,
|
|
47
47
|
"brotliLength": 0,
|
|
48
|
-
"mainUid": "
|
|
48
|
+
"mainUid": "287d-70"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"nodeMetas": {
|
|
52
|
-
"
|
|
52
|
+
"287d-66": {
|
|
53
53
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
54
54
|
"moduleParts": {
|
|
55
|
-
"index.production.js": "
|
|
55
|
+
"index.production.js": "287d-67"
|
|
56
56
|
},
|
|
57
57
|
"imported": [],
|
|
58
58
|
"importedBy": [
|
|
59
59
|
{
|
|
60
|
-
"uid": "
|
|
60
|
+
"uid": "287d-70"
|
|
61
61
|
}
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
|
-
"
|
|
64
|
+
"287d-68": {
|
|
65
65
|
"id": "/packages/router-core/build/esm/index.js",
|
|
66
66
|
"moduleParts": {
|
|
67
|
-
"index.production.js": "
|
|
67
|
+
"index.production.js": "287d-69"
|
|
68
68
|
},
|
|
69
69
|
"imported": [],
|
|
70
70
|
"importedBy": [
|
|
71
71
|
{
|
|
72
|
-
"uid": "
|
|
72
|
+
"uid": "287d-70"
|
|
73
73
|
}
|
|
74
74
|
]
|
|
75
75
|
},
|
|
76
|
-
"
|
|
76
|
+
"287d-70": {
|
|
77
77
|
"id": "/packages/react-router/src/index.tsx",
|
|
78
78
|
"moduleParts": {
|
|
79
|
-
"index.production.js": "
|
|
79
|
+
"index.production.js": "287d-71"
|
|
80
80
|
},
|
|
81
81
|
"imported": [
|
|
82
82
|
{
|
|
83
|
-
"uid": "
|
|
83
|
+
"uid": "287d-66"
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
"uid": "
|
|
86
|
+
"uid": "287d-72"
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
|
-
"uid": "
|
|
89
|
+
"uid": "287d-73"
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
"uid": "
|
|
92
|
+
"uid": "287d-68"
|
|
93
93
|
}
|
|
94
94
|
],
|
|
95
95
|
"importedBy": [],
|
|
96
96
|
"isEntry": true
|
|
97
97
|
},
|
|
98
|
-
"
|
|
98
|
+
"287d-72": {
|
|
99
99
|
"id": "react",
|
|
100
100
|
"moduleParts": {},
|
|
101
101
|
"imported": [],
|
|
102
102
|
"importedBy": [
|
|
103
103
|
{
|
|
104
|
-
"uid": "
|
|
104
|
+
"uid": "287d-70"
|
|
105
105
|
}
|
|
106
106
|
],
|
|
107
107
|
"isExternal": true
|
|
108
108
|
},
|
|
109
|
-
"
|
|
109
|
+
"287d-73": {
|
|
110
110
|
"id": "use-sync-external-store/shim",
|
|
111
111
|
"moduleParts": {},
|
|
112
112
|
"imported": [],
|
|
113
113
|
"importedBy": [
|
|
114
114
|
{
|
|
115
|
-
"uid": "
|
|
115
|
+
"uid": "287d-70"
|
|
116
116
|
}
|
|
117
117
|
],
|
|
118
118
|
"isExternal": true
|
package/build/types/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ type PromptProps = {
|
|
|
79
79
|
children?: React.ReactNode;
|
|
80
80
|
};
|
|
81
81
|
declare function Link<TTo extends string = '.'>(props: MakeLinkOptions<RegisteredAllRouteInfo, '/', TTo>): JSX.Element;
|
|
82
|
-
declare const matchesContext: React.Context<RouteMatch<DefaultAllRouteInfo, RouteInfo<string, string, string, string, {}, {}, {}, unknown, unknown, {}, {}, {}, {},
|
|
82
|
+
declare const matchesContext: React.Context<RouteMatch<DefaultAllRouteInfo, RouteInfo<string, string, string, string, {}, {}, {}, {}, unknown, unknown, {}, {}, {}, {}, {}, {}>>[]>;
|
|
83
83
|
declare const routerContext: React.Context<{
|
|
84
84
|
router: RegisteredRouter;
|
|
85
85
|
}>;
|
|
@@ -1070,7 +1070,7 @@
|
|
|
1070
1070
|
};
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
|
-
if (part.charAt(0) === '
|
|
1073
|
+
if (part.charAt(0) === '$') {
|
|
1074
1074
|
return {
|
|
1075
1075
|
type: 'param',
|
|
1076
1076
|
value: part
|
|
@@ -1167,7 +1167,7 @@
|
|
|
1167
1167
|
return false;
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
|
-
if (
|
|
1170
|
+
if (baseSegment.value.charAt(0) !== '$') {
|
|
1171
1171
|
params[routeSegment.value.substring(1)] = baseSegment.value;
|
|
1172
1172
|
}
|
|
1173
1173
|
}
|
|
@@ -1429,9 +1429,11 @@
|
|
|
1429
1429
|
fullPath: fullPath,
|
|
1430
1430
|
options: options,
|
|
1431
1431
|
children,
|
|
1432
|
-
createChildren: cb => createRouteConfig(options, cb(childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath)), false, parentId, parentPath),
|
|
1433
1432
|
addChildren: children => createRouteConfig(options, children, false, parentId, parentPath),
|
|
1434
|
-
createRoute: childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath)
|
|
1433
|
+
createRoute: childOptions => createRouteConfig(childOptions, undefined, false, id, fullPath),
|
|
1434
|
+
generate: () => {
|
|
1435
|
+
invariant(false, "routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. ");
|
|
1436
|
+
}
|
|
1435
1437
|
};
|
|
1436
1438
|
};
|
|
1437
1439
|
|
|
@@ -2828,7 +2830,8 @@
|
|
|
2828
2830
|
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
2829
2831
|
fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, null)
|
|
2830
2832
|
}, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
|
|
2831
|
-
errorComponent: errorComponent
|
|
2833
|
+
errorComponent: errorComponent,
|
|
2834
|
+
key: match.routeId
|
|
2832
2835
|
}, (() => {
|
|
2833
2836
|
if (match.status === 'error') {
|
|
2834
2837
|
throw match.error;
|
|
@@ -2848,7 +2851,8 @@
|
|
|
2848
2851
|
constructor() {
|
|
2849
2852
|
super(...arguments);
|
|
2850
2853
|
this.state = {
|
|
2851
|
-
error: false
|
|
2854
|
+
error: false,
|
|
2855
|
+
info: undefined
|
|
2852
2856
|
};
|
|
2853
2857
|
}
|
|
2854
2858
|
|
|
@@ -2861,17 +2865,49 @@
|
|
|
2861
2865
|
}
|
|
2862
2866
|
|
|
2863
2867
|
render() {
|
|
2864
|
-
|
|
2868
|
+
return /*#__PURE__*/React__namespace.createElement(CatchBoundaryInner, _extends$2({}, this.props, {
|
|
2869
|
+
errorState: this.state,
|
|
2870
|
+
reset: () => this.setState({})
|
|
2871
|
+
}));
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2874
|
+
} // This is the messiest thing ever... I'm either seriously tired (likely) or
|
|
2875
|
+
// there has to be a better way to reset error boundaries when the
|
|
2876
|
+
// router's location key changes.
|
|
2865
2877
|
|
|
2866
|
-
const errorComponent = (_this$props$errorComp = this.props.errorComponent) != null ? _this$props$errorComp : DefaultErrorBoundary;
|
|
2867
2878
|
|
|
2868
|
-
|
|
2869
|
-
|
|
2879
|
+
function CatchBoundaryInner(props) {
|
|
2880
|
+
var _props$errorComponent;
|
|
2881
|
+
|
|
2882
|
+
const [activeErrorState, setActiveErrorState] = React__namespace.useState(props.errorState);
|
|
2883
|
+
const router = useRouter();
|
|
2884
|
+
const errorComponent = (_props$errorComponent = props.errorComponent) != null ? _props$errorComponent : DefaultErrorBoundary;
|
|
2885
|
+
React__namespace.useEffect(() => {
|
|
2886
|
+
if (activeErrorState) {
|
|
2887
|
+
let prevKey = router.state.location.key;
|
|
2888
|
+
return router.subscribe(() => {
|
|
2889
|
+
if (router.state.location.key !== prevKey) {
|
|
2890
|
+
prevKey = router.state.location.key;
|
|
2891
|
+
setActiveErrorState({});
|
|
2892
|
+
}
|
|
2893
|
+
});
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
return;
|
|
2897
|
+
}, [activeErrorState]);
|
|
2898
|
+
React__namespace.useEffect(() => {
|
|
2899
|
+
if (props.errorState.error) {
|
|
2900
|
+
setActiveErrorState(props.errorState);
|
|
2870
2901
|
}
|
|
2871
2902
|
|
|
2872
|
-
|
|
2903
|
+
props.reset();
|
|
2904
|
+
}, [props.errorState.error]);
|
|
2905
|
+
|
|
2906
|
+
if (activeErrorState.error) {
|
|
2907
|
+
return /*#__PURE__*/React__namespace.createElement(errorComponent, activeErrorState);
|
|
2873
2908
|
}
|
|
2874
2909
|
|
|
2910
|
+
return props.children;
|
|
2875
2911
|
}
|
|
2876
2912
|
|
|
2877
2913
|
function DefaultErrorBoundary(_ref6) {
|