Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 82a8d82

Browse files
authored
Added new tag values for 16.6+ (#1190)
* Added new tag values for 16.6+ * Removed never-released *Lazy tags
1 parent 48ecaa4 commit 82a8d82

File tree

1 file changed

+57
-34
lines changed

1 file changed

+57
-34
lines changed

backend/attachRendererFiber.js

Lines changed: 57 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,51 +23,77 @@ function getInternalReactConstants(version) {
2323
var ReactTypeOfSideEffect;
2424

2525
// **********************************************************
26-
// The section below is copy-pasted from files in React repo.
26+
// The section below is copied from files in React repo.
2727
// Keep it in sync, and add version guards if it changes.
2828
// **********************************************************
29-
if (semver.gte(version, '16.4.3-alpha')) {
29+
if (semver.gte(version, '16.6.0-beta.0')) {
3030
ReactTypeOfWork = {
31+
ClassComponent: 1,
32+
ContextConsumer: 9,
33+
ContextProvider: 10,
34+
CoroutineComponent: -1, // Removed
35+
CoroutineHandlerPhase: -1, // Removed
36+
ForwardRef: 11,
37+
Fragment: 7,
3138
FunctionalComponent: 0,
32-
FunctionalComponentLazy: 1,
39+
HostComponent: 5,
40+
HostPortal: 4,
41+
HostRoot: 3,
42+
HostText: 6,
43+
IndeterminateComponent: 2,
44+
LazyComponent: 16,
45+
MemoComponent: 14,
46+
Mode: 8,
47+
Profiler: 12,
48+
SimpleMemoComponent: 15,
49+
SuspenseComponent: 13,
50+
YieldComponent: -1, // Removed
51+
};
52+
} else if (semver.gte(version, '16.4.3-alpha')) {
53+
ReactTypeOfWork = {
3354
ClassComponent: 2,
34-
ClassComponentLazy: 3,
35-
IndeterminateComponent: 4,
36-
HostRoot: 5,
37-
HostPortal: 6,
38-
HostComponent: 7,
39-
HostText: 8,
40-
Fragment: 9,
41-
Mode: 10,
4255
ContextConsumer: 11,
4356
ContextProvider: 12,
57+
CoroutineComponent: -1, // Removed
58+
CoroutineHandlerPhase: -1, // Removed
4459
ForwardRef: 13,
45-
ForwardRefLazy: 14,
60+
Fragment: 9,
61+
FunctionalComponent: 0,
62+
HostComponent: 7,
63+
HostPortal: 6,
64+
HostRoot: 5,
65+
HostText: 8,
66+
IndeterminateComponent: 4,
67+
LazyComponent: -1, // Doesn't exist yet
68+
MemoComponent: -1, // Doesn't exist yet
69+
Mode: 10,
4670
Profiler: 15,
47-
PlaceholderComponent: 16,
71+
SimpleMemoComponent: -1, // Doesn't exist yet
72+
SuspenseComponent: 16,
73+
YieldComponent: -1, // Removed
4874
};
4975
} else {
5076
ReactTypeOfWork = {
51-
IndeterminateComponent: 0,
52-
FunctionalComponent: 1,
53-
FunctionalComponentLazy: -1, // Doesn't exist yet
5477
ClassComponent: 2,
55-
ClassComponentLazy: -1, // Doesn't exist yet
56-
HostRoot: 3,
57-
HostPortal: 4,
58-
HostComponent: 5,
59-
HostText: 6,
78+
ContextConsumer: 12,
79+
ContextProvider: 13,
6080
CoroutineComponent: 7,
6181
CoroutineHandlerPhase: 8,
62-
YieldComponent: 9,
82+
ForwardRef: 14,
6383
Fragment: 10,
84+
FunctionalComponent: 1,
85+
HostComponent: 5,
86+
HostPortal: 4,
87+
HostRoot: 3,
88+
HostText: 6,
89+
IndeterminateComponent: 0,
90+
LazyComponent: -1, // Doesn't exist yet
91+
MemoComponent: -1, // Doesn't exist yet
6492
Mode: 11,
65-
ContextConsumer: 12,
66-
ContextProvider: 13,
67-
ForwardRef: 14,
68-
ForwardRefLazy: -1, // Doesn't exist yet
6993
Profiler: 15,
70-
Placeholder: 16,
94+
SimpleMemoComponent: -1, // Doesn't exist yet
95+
SuspenseComponent: 16,
96+
YieldComponent: 9,
7197
};
7298
}
7399
ReactSymbols = {
@@ -94,8 +120,9 @@ function getInternalReactConstants(version) {
94120
PerformedWork: 1,
95121
};
96122
// **********************************************************
97-
// End of copy paste.
123+
// End of copied code.
98124
// **********************************************************
125+
99126
return {
100127
ReactTypeOfWork,
101128
ReactSymbols,
@@ -108,17 +135,14 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
108135
var {PerformedWork} = ReactTypeOfSideEffect;
109136
var {
110137
FunctionalComponent,
111-
FunctionalComponentLazy,
112138
ClassComponent,
113-
ClassComponentLazy,
114139
ContextConsumer,
115140
HostRoot,
116141
HostPortal,
117142
HostComponent,
118143
HostText,
119144
Fragment,
120145
ForwardRef,
121-
ForwardRefLazy,
122146
} = ReactTypeOfWork;
123147
var {
124148
CONCURRENT_MODE_NUMBER,
@@ -168,11 +192,11 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
168192
}
169193
}
170194

195+
// TODO: Add support for new tags LazyComponent, MemoComponent, and SimpleMemoComponent
196+
171197
switch (fiber.tag) {
172198
case FunctionalComponent:
173-
case FunctionalComponentLazy:
174199
case ClassComponent:
175-
case ClassComponentLazy:
176200
nodeType = 'Composite';
177201
name = getDisplayName(resolvedType);
178202
publicInstance = fiber.stateNode;
@@ -197,7 +221,6 @@ function attachRendererFiber(hook: Hook, rid: string, renderer: ReactRenderer):
197221
children = [];
198222
break;
199223
case ForwardRef:
200-
case ForwardRefLazy:
201224
const functionName = getDisplayName(resolvedType.render, '');
202225
nodeType = 'Special';
203226
name = resolvedType.displayName || (

0 commit comments

Comments
 (0)