MCPcopy Index your code
hub / github.com/react/react / pushTreeFork

Function pushTreeFork

packages/react-reconciler/src/ReactFiberTreeContext.js:106–132  ·  view source on GitHub ↗
(
  workInProgress: Fiber,
  totalChildren: number,
)

Source from the content-addressed store, hash-verified

104}
105
106export function pushTreeFork(
107 workInProgress: Fiber,
108 totalChildren: number,
109): void {
110 // This is called right after we reconcile an array (or iterator) of child
111 // fibers, because that's the only place where we know how many children in
112 // the whole set without doing extra work later, or storing addtional
113 // information on the fiber.
114 //
115 // That's why this function is separate from pushTreeId — it's called during
116 // the render phase of the fork parent, not the child, which is where we push
117 // the other context values.
118 //
119 // In the Fizz implementation this is much simpler because the child is
120 // rendered in the same callstack as the parent.
121 //
122 // It might be better to just add a `forks` field to the Fiber type. It would
123 // make this module simpler.
124
125 warnIfNotHydrating();
126
127 forkStack[forkStackIndex++] = treeForkCount;
128 forkStack[forkStackIndex++] = treeForkProvider;
129
130 treeForkProvider = workInProgress;
131 treeForkCount = totalChildren;
132}
133
134export function pushTreeId(
135 workInProgress: Fiber,

Callers 4

reconcileChildrenArrayFunction · 0.90
completeWorkFunction · 0.90
pushMaterializedTreeIdFunction · 0.85

Calls 1

warnIfNotHydratingFunction · 0.85

Tested by

no test coverage detected