Home / Function/ popHostContext() — react Function Reference

popHostContext() — react Function Reference

Architecture documentation for the popHostContext() function in ReactFiberHostContext.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  d1a95e98_467c_e9b8_af34_7d3813a82b6b["popHostContext()"]
  0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0["ReactFiberHostContext.js"]
  d1a95e98_467c_e9b8_af34_7d3813a82b6b -->|defined in| 0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0
  0b8db832_87fd_e560_8aa8_e2b319c81626["completeWork()"]
  0b8db832_87fd_e560_8aa8_e2b319c81626 -->|calls| d1a95e98_467c_e9b8_af34_7d3813a82b6b
  ff527c73_3068_e15f_a742_b0c855fedff9["unwindWork()"]
  ff527c73_3068_e15f_a742_b0c855fedff9 -->|calls| d1a95e98_467c_e9b8_af34_7d3813a82b6b
  0858c166_63a6_03b3_cf3f_1f44b4c20708["unwindInterruptedWork()"]
  0858c166_63a6_03b3_cf3f_1f44b4c20708 -->|calls| d1a95e98_467c_e9b8_af34_7d3813a82b6b
  a05eb624_1205_fe14_d003_611163eae529["pushHostContext()"]
  d1a95e98_467c_e9b8_af34_7d3813a82b6b -->|calls| a05eb624_1205_fe14_d003_611163eae529
  style d1a95e98_467c_e9b8_af34_7d3813a82b6b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberHostContext.js lines 131–158

function popHostContext(fiber: Fiber): void {
  if (contextFiberStackCursor.current === fiber) {
    // Do not pop unless this Fiber provided the current context.
    // pushHostContext() only pushes Fibers that provide unique contexts.
    pop(contextStackCursor, fiber);
    pop(contextFiberStackCursor, fiber);
  }

  if (hostTransitionProviderCursor.current === fiber) {
    // Do not pop unless this Fiber provided the current context. This is mostly
    // a performance optimization, but conveniently it also prevents a potential
    // data race where a host provider is upgraded (i.e. memoizedState becomes
    // non-null) during a concurrent event. This is a bit of a flaw in the way
    // we upgrade host components, but because we're accounting for it here, it
    // should be fine.
    pop(hostTransitionProviderCursor, fiber);

    // When popping the transition provider, we reset the context value back
    // to `NotPendingTransition`. We can do this because you're not allowed to nest forms. If
    // we allowed for multiple nested host transition providers, then we'd
    // need to reset this to the parent provider's status.
    if (isPrimaryRenderer) {
      HostTransitionContext._currentValue = NotPendingTransition;
    } else {
      HostTransitionContext._currentValue2 = NotPendingTransition;
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does popHostContext() do?
popHostContext() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberHostContext.js.
Where is popHostContext() defined?
popHostContext() is defined in packages/react-reconciler/src/ReactFiberHostContext.js at line 131.
What does popHostContext() call?
popHostContext() calls 1 function(s): pushHostContext.
What calls popHostContext()?
popHostContext() is called by 3 function(s): completeWork, unwindInterruptedWork, unwindWork.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free