MCPcopy
hub / github.com/facebook/react / popTreeContext

Function popTreeContext

packages/react-reconciler/src/ReactFiberTreeContext.js:228–251  ·  view source on GitHub ↗
(workInProgress: Fiber)

Source from the content-addressed store, hash-verified

226}
227
228export function popTreeContext(workInProgress: Fiber) {
229 // Restore the previous values.
230
231 // This is a bit more complicated than other context-like modules in Fiber
232 // because the same Fiber may appear on the stack multiple times and for
233 // different reasons. We have to keep popping until the work-in-progress is
234 // no longer at the top of the stack.
235
236 while (workInProgress === treeForkProvider) {
237 treeForkProvider = forkStack[--forkStackIndex];
238 forkStack[forkStackIndex] = null;
239 treeForkCount = forkStack[--forkStackIndex];
240 forkStack[forkStackIndex] = null;
241 }
242
243 while (workInProgress === treeContextProvider) {
244 treeContextProvider = idStack[--idStackIndex];
245 idStack[idStackIndex] = null;
246 treeContextOverflow = idStack[--idStackIndex];
247 idStack[idStackIndex] = null;
248 treeContextId = idStack[--idStackIndex];
249 idStack[idStackIndex] = null;
250 }
251}
252
253export function getSuspendedTreeContext(): TreeContext | null {
254 warnIfNotHydrating();

Callers 3

unwindWorkFunction · 0.90
unwindInterruptedWorkFunction · 0.90
completeWorkFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected