Home / Function/ pushHostContainer() — react Function Reference

pushHostContainer() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e104a7c6_8b49_d343_834d_bfd8cdc38b6d["pushHostContainer()"]
  0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0["ReactFiberHostContext.js"]
  e104a7c6_8b49_d343_834d_bfd8cdc38b6d -->|defined in| 0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0
  709caba0_6dab_3197_d227_28b3fa3a6dc4["pushHostRootContext()"]
  709caba0_6dab_3197_d227_28b3fa3a6dc4 -->|calls| e104a7c6_8b49_d343_834d_bfd8cdc38b6d
  34c6ce5d_a29b_1593_e4b1_ed95494a5da8["updatePortalComponent()"]
  34c6ce5d_a29b_1593_e4b1_ed95494a5da8 -->|calls| e104a7c6_8b49_d343_834d_bfd8cdc38b6d
  df2c7818_4611_b8d2_dfe8_a79e5972020c["attemptEarlyBailoutIfNoScheduledUpdate()"]
  df2c7818_4611_b8d2_dfe8_a79e5972020c -->|calls| e104a7c6_8b49_d343_834d_bfd8cdc38b6d
  style e104a7c6_8b49_d343_834d_bfd8cdc38b6d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberHostContext.js lines 65–83

function pushHostContainer(fiber: Fiber, nextRootInstance: Container): void {
  // Push current root instance onto the stack;
  // This allows us to reset root when portals are popped.
  push(rootInstanceStackCursor, nextRootInstance, fiber);
  // Track the context and the Fiber that provided it.
  // This enables us to pop only Fibers that provide unique contexts.
  push(contextFiberStackCursor, fiber, fiber);

  // Finally, we need to push the host context to the stack.
  // However, we can't just call getRootHostContext() and push it because
  // we'd have a different number of entries on the stack depending on
  // whether getRootHostContext() throws somewhere in renderer code or not.
  // So we push an empty value first. This lets us safely unwind on errors.
  push(contextStackCursor, null, fiber);
  const nextRootContext = getRootHostContext(nextRootInstance);
  // Now that we know this function doesn't throw, replace it.
  pop(contextStackCursor, fiber);
  push(contextStackCursor, nextRootContext, fiber);
}

Domain

Subdomains

Frequently Asked Questions

What does pushHostContainer() do?
pushHostContainer() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberHostContext.js.
Where is pushHostContainer() defined?
pushHostContainer() is defined in packages/react-reconciler/src/ReactFiberHostContext.js at line 65.
What calls pushHostContainer()?
pushHostContainer() is called by 3 function(s): attemptEarlyBailoutIfNoScheduledUpdate, pushHostRootContext, updatePortalComponent.

Analyze Your Own Codebase

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

Try Supermodel Free