Home / Function/ ReactSharedInternals() — react Function Reference

ReactSharedInternals() — react Function Reference

Architecture documentation for the ReactSharedInternals() function in ReactFiberTransition.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  5016b59c_36d5_c0b9_3051_0db05af2c0f7["ReactSharedInternals()"]
  7b9cb3e8_e71c_27b2_61e8_fe54f0f80f0b["ReactFiberTransition.js"]
  5016b59c_36d5_c0b9_3051_0db05af2c0f7 -->|defined in| 7b9cb3e8_e71c_27b2_61e8_fe54f0f80f0b
  615218a1_42bf_c3aa_c0fa_ff6fadfb674e["startAsyncTransitionTimer()"]
  5016b59c_36d5_c0b9_3051_0db05af2c0f7 -->|calls| 615218a1_42bf_c3aa_c0fa_ff6fadfb674e
  70fbeee1_0718_4457_4ee0_2795a657f93d["queueTransitionTypes()"]
  5016b59c_36d5_c0b9_3051_0db05af2c0f7 -->|calls| 70fbeee1_0718_4457_4ee0_2795a657f93d
  ace37a1b_be5c_21e8_6160_7658c3d49ad8["entangleAsyncTransitionTypes()"]
  5016b59c_36d5_c0b9_3051_0db05af2c0f7 -->|calls| ace37a1b_be5c_21e8_6160_7658c3d49ad8
  style 5016b59c_36d5_c0b9_3051_0db05af2c0f7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberTransition.js lines 79–130

ReactSharedInternals.S = function onStartTransitionFinishForReconciler(
  transition: Transition,
  returnValue: mixed,
) {
  markTransitionStarted();
  if (
    typeof returnValue === 'object' &&
    returnValue !== null &&
    typeof returnValue.then === 'function'
  ) {
    // If we're going to wait on some async work before scheduling an update.
    // We mark the time so we can later log how long we were blocked on the Action.
    // Ideally, we'd include the sync part of the action too but since that starts
    // in isomorphic code it currently leads to tricky layering. We'd have to pass
    // in performance.now() to this callback but we sometimes use a polyfill.
    startAsyncTransitionTimer();

    // This is an async action
    const thenable: Thenable<mixed> = (returnValue: any);
    entangleAsyncAction(transition, thenable);
  }
  if (enableViewTransition) {
    if (entangledTransitionTypes !== null) {
      // If we scheduled work on any new roots, we need to add any entangled async
      // transition types to those roots too.
      let root = firstScheduledRoot;
      while (root !== null) {
        queueTransitionTypes(root, entangledTransitionTypes);
        root = root.next;
      }
    }
    const transitionTypes = transition.types;
    if (transitionTypes !== null) {
      // Within this Transition we should've now scheduled any roots we have updates
      // to work on. If there are no updates on a root, then the Transition type won't
      // be applied to that root.
      let root = firstScheduledRoot;
      while (root !== null) {
        queueTransitionTypes(root, transitionTypes);
        root = root.next;
      }
      if (peekEntangledActionLane() !== NoLane) {
        // If we have entangled, async actions going on, the update associated with
        // these types might come later. We need to save them for later.
        entangleAsyncTransitionTypes(transitionTypes);
      }
    }
  }
  if (prevOnStartTransitionFinish !== null) {
    prevOnStartTransitionFinish(transition, returnValue);
  }
};

Domain

Subdomains

Frequently Asked Questions

What does ReactSharedInternals() do?
ReactSharedInternals() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberTransition.js.
Where is ReactSharedInternals() defined?
ReactSharedInternals() is defined in packages/react-reconciler/src/ReactFiberTransition.js at line 79.
What does ReactSharedInternals() call?
ReactSharedInternals() calls 3 function(s): entangleAsyncTransitionTypes, queueTransitionTypes, startAsyncTransitionTimer.

Analyze Your Own Codebase

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

Try Supermodel Free