Skip to content

Commit f71d9c3

Browse files
authored
[Flight] Chunks API (#17398)
* Add feature flags * Add Chunk type and constructor * Wire up Chunk support in the reconciler * Update reconciler to reconcile Chunks against the render method This allows the query and args to be updated. * Drop the ref. Chunks cannot have refs anyway. * Add Chunk checks in more missing cases * Rename secondArg * Add test and fix lazy chunks Not really a supported use case but for consistency I guess. * Fix fragment test
1 parent 6f84763 commit f71d9c3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/ReactTestRenderer.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
Profiler,
3737
MemoComponent,
3838
SimpleMemoComponent,
39+
Chunk,
3940
IncompleteClassComponent,
4041
ScopeComponent,
4142
} from 'shared/ReactWorkTags';
@@ -185,6 +186,14 @@ function toTree(node: ?Fiber) {
185186
instance: null,
186187
rendered: childrenToTree(node.child),
187188
};
189+
case Chunk:
190+
return {
191+
nodeType: 'chunk',
192+
type: node.type,
193+
props: {...node.memoizedProps},
194+
instance: null,
195+
rendered: childrenToTree(node.child),
196+
};
188197
case HostComponent: {
189198
return {
190199
nodeType: 'host',
@@ -222,6 +231,7 @@ const validWrapperTypes = new Set([
222231
ForwardRef,
223232
MemoComponent,
224233
SimpleMemoComponent,
234+
Chunk,
225235
// Normally skipped, but used when there's more than one root child.
226236
HostRoot,
227237
]);

0 commit comments

Comments
 (0)