Home / Function/ preloadResourceAndSuspendIfNeeded() — react Function Reference

preloadResourceAndSuspendIfNeeded() — react Function Reference

Architecture documentation for the preloadResourceAndSuspendIfNeeded() function in ReactFiberCompleteWork.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f416042c_1372_a9d9_9727_83f52f21014b["preloadResourceAndSuspendIfNeeded()"]
  6b05669d_2f09_63a5_e79f_0afc195f25a3["ReactFiberCompleteWork.js"]
  f416042c_1372_a9d9_9727_83f52f21014b -->|defined in| 6b05669d_2f09_63a5_e79f_0afc195f25a3
  0b8db832_87fd_e560_8aa8_e2b319c81626["completeWork()"]
  0b8db832_87fd_e560_8aa8_e2b319c81626 -->|calls| f416042c_1372_a9d9_9727_83f52f21014b
  style f416042c_1372_a9d9_9727_83f52f21014b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberCompleteWork.js lines 605–628

function preloadResourceAndSuspendIfNeeded(
  workInProgress: Fiber,
  resource: Resource,
  type: Type,
  props: Props,
  renderLanes: Lanes,
) {
  // This is a fork of preloadInstanceAndSuspendIfNeeded, but for resources.
  if (!mayResourceSuspendCommit(resource)) {
    workInProgress.flags &= ~MaySuspendCommit;
    return;
  }

  workInProgress.flags |= MaySuspendCommit;

  const isReady = preloadResource(resource);
  if (!isReady) {
    if (shouldRemainOnPreviousScreen()) {
      workInProgress.flags |= ShouldSuspendCommit;
    } else {
      suspendCommit();
    }
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does preloadResourceAndSuspendIfNeeded() do?
preloadResourceAndSuspendIfNeeded() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberCompleteWork.js.
Where is preloadResourceAndSuspendIfNeeded() defined?
preloadResourceAndSuspendIfNeeded() is defined in packages/react-reconciler/src/ReactFiberCompleteWork.js at line 605.
What calls preloadResourceAndSuspendIfNeeded()?
preloadResourceAndSuspendIfNeeded() is called by 1 function(s): completeWork.

Analyze Your Own Codebase

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

Try Supermodel Free