You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have dropped `withAsyncComponents` and replaced it with `asyncBootstrapper` that is sourced from the generalised `react-async-bootstrapper` library. This gives us a greater degree of flexibility and interoperability with other libraries that have asynchronous bootstrapping needs. You are now required to manually wrap your application with an instance of the `AsyncComponentProvider`.
The `Loading` component option for `createAsyncComponent` has been renamed to `LoadingComponent`.
An `ErrorComponent` component option has been added to the `createAsyncComponent` helper, allowing you to render a custom error should a component resolver fail.
Copy file name to clipboardExpand all lines: src/__tests__/__snapshots__/integration.test.js.snap
+81-2Lines changed: 81 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,12 @@
1
1
// Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
3
-
exports[`integration tests render server and client 1`] =`"<div><div><div><span>In Render.</span></div><div><span>In Boundary but outside an AsyncComponent, server render me!</span></div></div></div>"`;
3
+
exports[`integration tests render server and client 1`] =`"<div><div><div><span>In Render.</span></div><div>DeferredAsyncBob Loading</div><div><span>In Boundary but outside an AsyncComponent, server render me!</span></div><div>This always errors</div></div></div>"`;
4
4
5
5
exports[`integration tests render server and client 2`] =`
6
6
Object {
7
+
"errors": Object {
8
+
"6": "This always errors",
9
+
},
7
10
"resolved": Object {
8
11
"1": true,
9
12
"2": true,
@@ -17,9 +20,11 @@ exports[`integration tests render server and client 3`] = `
17
20
execContext={
18
21
Object {
19
22
"getComponent": [Function],
23
+
"getError": [Function],
20
24
"getNextId": [Function],
21
25
"getState": [Function],
22
26
"registerComponent": [Function],
27
+
"registerError": [Function],
23
28
}
24
29
}
25
30
>
@@ -36,7 +41,13 @@ exports[`integration tests render server and client 3`] = `
36
41
</div>
37
42
</Bob>
38
43
</AsyncBobTwo>
39
-
<DeferredAsyncBob />
44
+
<DeferredAsyncBob>
45
+
<LoadingComponent>
46
+
<div>
47
+
DeferredAsyncBob Loading
48
+
</div>
49
+
</LoadingComponent>
50
+
</DeferredAsyncBob>
40
51
<BoundaryAsyncBob>
41
52
<Bob>
42
53
<div>
@@ -47,6 +58,15 @@ exports[`integration tests render server and client 3`] = `
47
58
</div>
48
59
</Bob>
49
60
</BoundaryAsyncBob>
61
+
<ErrorAsyncComponent>
62
+
<ErrorComponent
63
+
message="This always errors"
64
+
>
65
+
<div>
66
+
This always errors
67
+
</div>
68
+
</ErrorComponent>
69
+
</ErrorAsyncComponent>
50
70
</div>
51
71
</div>
52
72
</Bob>
@@ -59,9 +79,11 @@ exports[`integration tests render server and client 4`] = `
59
79
execContext={
60
80
Object {
61
81
"getComponent": [Function],
82
+
"getError": [Function],
62
83
"getNextId": [Function],
63
84
"getState": [Function],
64
85
"registerComponent": [Function],
86
+
"registerError": [Function],
65
87
}
66
88
}
67
89
>
@@ -105,9 +127,66 @@ exports[`integration tests render server and client 4`] = `
105
127
</div>
106
128
</Bob>
107
129
</BoundaryAsyncBob>
130
+
<ErrorAsyncComponent>
131
+
<ErrorComponent
132
+
message="This always errors"
133
+
>
134
+
<div>
135
+
This always errors
136
+
</div>
137
+
</ErrorComponent>
138
+
</ErrorAsyncComponent>
108
139
</div>
109
140
</div>
110
141
</Bob>
111
142
</AsyncBob>
112
143
</AsyncComponentProvider>
113
144
`;
145
+
146
+
exports[`integration tests renders the ErrorComponent 1`] =`
147
+
<AsyncComponentProvider
148
+
execContext={
149
+
Object {
150
+
"getComponent": [Function],
151
+
"getError": [Function],
152
+
"getNextId": [Function],
153
+
"getState": [Function],
154
+
"registerComponent": [Function],
155
+
"registerError": [Function],
156
+
}
157
+
}
158
+
>
159
+
<AsyncComponent>
160
+
<ErrorComponent
161
+
message="An error occurred"
162
+
>
163
+
<div>
164
+
An error occurred
165
+
</div>
166
+
</ErrorComponent>
167
+
</AsyncComponent>
168
+
</AsyncComponentProvider>
169
+
`;
170
+
171
+
exports[`integration tests renders the LoadingComponent 1`] =`
0 commit comments