Home / Function/ recursivelyInsertNewFiber() — react Function Reference

recursivelyInsertNewFiber() — react Function Reference

Architecture documentation for the recursivelyInsertNewFiber() function in ReactFiberApplyGesture.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  14488ed6_0070_cb72_08ff_37fc5c860d29["recursivelyInsertNewFiber()"]
  ee850b36_fc0b_9bb2_5b69_58d705aef9a5["ReactFiberApplyGesture.js"]
  14488ed6_0070_cb72_08ff_37fc5c860d29 -->|defined in| ee850b36_fc0b_9bb2_5b69_58d705aef9a5
  432ab70d_b735_f25a_7b06_2d452817db65["recursivelyInsertNew()"]
  432ab70d_b735_f25a_7b06_2d452817db65 -->|calls| 14488ed6_0070_cb72_08ff_37fc5c860d29
  585297c1_5fbc_f778_b0fa_7f11968cec48["insertDestinationClonesOfFiber()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| 14488ed6_0070_cb72_08ff_37fc5c860d29
  432ab70d_b735_f25a_7b06_2d452817db65["recursivelyInsertNew()"]
  14488ed6_0070_cb72_08ff_37fc5c860d29 -->|calls| 432ab70d_b735_f25a_7b06_2d452817db65
  9fd588c7_bccc_26bc_b726_517f00094e4a["commitHookEffectListMount()"]
  14488ed6_0070_cb72_08ff_37fc5c860d29 -->|calls| 9fd588c7_bccc_26bc_b726_517f00094e4a
  c1429200_7c6a_e13e_08a2_fa616dd968a7["trackHostMutation()"]
  14488ed6_0070_cb72_08ff_37fc5c860d29 -->|calls| c1429200_7c6a_e13e_08a2_fa616dd968a7
  10ff51a0_caf4_3442_72f9_fbea3bdcc8bc["pushMutationContext()"]
  14488ed6_0070_cb72_08ff_37fc5c860d29 -->|calls| 10ff51a0_caf4_3442_72f9_fbea3bdcc8bc
  e901b09e_6606_f374_768c_8c36e1bb4676["applyExitViewTransition()"]
  14488ed6_0070_cb72_08ff_37fc5c860d29 -->|calls| e901b09e_6606_f374_768c_8c36e1bb4676
  4d7237b6_d6aa_66af_1ea0_e984a1cd77c4["applyAppearingPairViewTransition()"]
  14488ed6_0070_cb72_08ff_37fc5c860d29 -->|calls| 4d7237b6_d6aa_66af_1ea0_e984a1cd77c4
  e85c52cb_0e14_c3e5_2d41_fe535fe1ddf7["popMutationContext()"]
  14488ed6_0070_cb72_08ff_37fc5c860d29 -->|calls| e85c52cb_0e14_c3e5_2d41_fe535fe1ddf7
  style 14488ed6_0070_cb72_08ff_37fc5c860d29 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberApplyGesture.js lines 410–579

function recursivelyInsertNewFiber(
  finishedWork: Fiber,
  hostParentClone: Instance,
  parentViewTransition: null | ViewTransitionState,
  visitPhase: VisitPhase,
): void {
  switch (finishedWork.tag) {
    case FunctionComponent:
    case ForwardRef:
    case MemoComponent:
    case SimpleMemoComponent: {
      recursivelyInsertNew(
        finishedWork,
        hostParentClone,
        parentViewTransition,
        visitPhase,
      );
      if (finishedWork.flags & Update) {
        // Insertion Effects are mounted temporarily during the rendering of the snapshot.
        // This does not affect cloned Offscreen content since those would've been mounted
        // while inside the offscreen tree already.
        // Note that because we are mounting a clone of the DOM tree and the previous DOM
        // tree remains mounted during the snapshot, we can't unmount any previous insertion
        // effects. This can lead to conflicts but that is similar to what can happen with
        // conflicts for two mounted Activity boundaries.
        commitHookEffectListMount(HookInsertion | HookHasEffect, finishedWork);
      }
      break;
    }
    case HostHoistable: {
      if (supportsResources) {
        // TODO: Hoistables should get optimistically inserted and then removed.
        recursivelyInsertNew(
          finishedWork,
          hostParentClone,
          parentViewTransition,
          visitPhase,
        );
        break;
      }
      // Fall through
    }
    case HostSingleton: {
      if (supportsSingletons) {
        recursivelyInsertNew(
          finishedWork,
          hostParentClone,
          parentViewTransition,
          visitPhase,
        );

        if (__DEV__) {
          // We cannot apply mutations to Host Singletons since by definition
          // they cannot be cloned. Therefore we warn in DEV if this commit
          // had any effect.
          if (finishedWork.flags & Update) {
            console.error(
              'startGestureTransition() caused something to render a new <%s>. ' +
                'This is not possible in the current implementation. ' +
                "Make sure that the swipe doesn't mount any new <%s> elements.",
              finishedWork.type,
              finishedWork.type,
            );
          }
        }
        break;
      }
      // Fall through
    }
    case HostComponent: {
      const instance: Instance = finishedWork.stateNode;
      // For insertions we don't need to clone. It's already new state node.
      if (visitPhase !== INSERT_APPEARING_PAIR) {
        appendChild(hostParentClone, instance);
        trackHostMutation();
        recursivelyInsertNew(
          finishedWork,
          instance,
          null,
          INSERT_APPEARING_PAIR,
        );

Domain

Subdomains

Frequently Asked Questions

What does recursivelyInsertNewFiber() do?
recursivelyInsertNewFiber() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberApplyGesture.js.
Where is recursivelyInsertNewFiber() defined?
recursivelyInsertNewFiber() is defined in packages/react-reconciler/src/ReactFiberApplyGesture.js at line 410.
What does recursivelyInsertNewFiber() call?
recursivelyInsertNewFiber() calls 7 function(s): applyAppearingPairViewTransition, applyExitViewTransition, commitHookEffectListMount, popMutationContext, pushMutationContext, recursivelyInsertNew, trackHostMutation.
What calls recursivelyInsertNewFiber()?
recursivelyInsertNewFiber() is called by 2 function(s): insertDestinationClonesOfFiber, recursivelyInsertNew.

Analyze Your Own Codebase

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

Try Supermodel Free