Skip to content

Commit 3ee8489

Browse files
sebmarkbageAndrew Clark
authored andcommitted
Unfork Lazy Component Branches (#13902)
* Introduce elementType field This will be used to store the wrapped type of an element. E.g. pure and lazy. The existing type field will be used for the unwrapped type within them. * Store the unwrapped type on the type field of lazy components * Use the raw tags for lazy components Instead, we check if the elementType and type are equal to test if we need to resolve props. This is slightly slower in the normal case but will yield less code and branching. * Clean up lazy branches * Collapse work tag numbering * Split IndeterminateComponent out from Lazy This way we don't have to check the type in a hacky way in the indeterminate path. Also, lets us deal with lazy that resolves to indeterminate and such. * Missing clean up in rebase
1 parent 7615321 commit 3ee8489

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/ReactTestRenderer.js

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ import {findCurrentFiberUsingSlowPath} from 'react-reconciler/reflection';
1717
import {
1818
Fragment,
1919
FunctionComponent,
20-
FunctionComponentLazy,
2120
ClassComponent,
22-
ClassComponentLazy,
2321
HostComponent,
2422
HostPortal,
2523
HostText,
@@ -29,9 +27,7 @@ import {
2927
Mode,
3028
ForwardRef,
3129
Profiler,
32-
ForwardRefLazy,
3330
PureComponent,
34-
PureComponentLazy,
3531
} from 'shared/ReactWorkTags';
3632
import invariant from 'shared/invariant';
3733
import ReactVersion from 'shared/ReactVersion';
@@ -169,17 +165,6 @@ function toTree(node: ?Fiber) {
169165
instance: node.stateNode,
170166
rendered: childrenToTree(node.child),
171167
};
172-
case ClassComponentLazy: {
173-
const thenable = node.type;
174-
const type = thenable._reactResult;
175-
return {
176-
nodeType: 'component',
177-
type,
178-
props: {...node.memoizedProps},
179-
instance: node.stateNode,
180-
rendered: childrenToTree(node.child),
181-
};
182-
}
183168
case FunctionComponent:
184169
return {
185170
nodeType: 'component',
@@ -188,17 +173,6 @@ function toTree(node: ?Fiber) {
188173
instance: null,
189174
rendered: childrenToTree(node.child),
190175
};
191-
case FunctionComponentLazy: {
192-
const thenable = node.type;
193-
const type = thenable._reactResult;
194-
return {
195-
nodeType: 'component',
196-
type: type,
197-
props: {...node.memoizedProps},
198-
instance: node.stateNode,
199-
rendered: childrenToTree(node.child),
200-
};
201-
}
202176
case HostComponent: {
203177
return {
204178
nodeType: 'host',
@@ -216,9 +190,7 @@ function toTree(node: ?Fiber) {
216190
case Mode:
217191
case Profiler:
218192
case ForwardRef:
219-
case ForwardRefLazy:
220193
case PureComponent:
221-
case PureComponentLazy:
222194
return childrenToTree(node.child);
223195
default:
224196
invariant(
@@ -231,14 +203,10 @@ function toTree(node: ?Fiber) {
231203

232204
const validWrapperTypes = new Set([
233205
FunctionComponent,
234-
FunctionComponentLazy,
235206
ClassComponent,
236-
ClassComponentLazy,
237207
HostComponent,
238208
ForwardRef,
239-
ForwardRefLazy,
240209
PureComponent,
241-
PureComponentLazy,
242210
// Normally skipped, but used when there's more than one root child.
243211
HostRoot,
244212
]);

0 commit comments

Comments
 (0)