Home / Function/ insertDestinationClonesOfFiber() — react Function Reference

insertDestinationClonesOfFiber() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  585297c1_5fbc_f778_b0fa_7f11968cec48["insertDestinationClonesOfFiber()"]
  ee850b36_fc0b_9bb2_5b69_58d705aef9a5["ReactFiberApplyGesture.js"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|defined in| ee850b36_fc0b_9bb2_5b69_58d705aef9a5
  5da5a209_accd_7ea4_eb0a_748553ba2647["recursivelyInsertClones()"]
  5da5a209_accd_7ea4_eb0a_748553ba2647 -->|calls| 585297c1_5fbc_f778_b0fa_7f11968cec48
  14488ed6_0070_cb72_08ff_37fc5c860d29["recursivelyInsertNewFiber()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| 14488ed6_0070_cb72_08ff_37fc5c860d29
  5da5a209_accd_7ea4_eb0a_748553ba2647["recursivelyInsertClones()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| 5da5a209_accd_7ea4_eb0a_748553ba2647
  10ff51a0_caf4_3442_72f9_fbea3bdcc8bc["pushMutationContext()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| 10ff51a0_caf4_3442_72f9_fbea3bdcc8bc
  e85c52cb_0e14_c3e5_2d41_fe535fe1ddf7["popMutationContext()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| e85c52cb_0e14_c3e5_2d41_fe535fe1ddf7
  c1429200_7c6a_e13e_08a2_fa616dd968a7["trackHostMutation()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| c1429200_7c6a_e13e_08a2_fa616dd968a7
  282c3969_f657_3d4a_7c17_9af393a5187a["trackEnterViewTransitions()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| 282c3969_f657_3d4a_7c17_9af393a5187a
  e901b09e_6606_f374_768c_8c36e1bb4676["applyExitViewTransition()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| e901b09e_6606_f374_768c_8c36e1bb4676
  4d7237b6_d6aa_66af_1ea0_e984a1cd77c4["applyAppearingPairViewTransition()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| 4d7237b6_d6aa_66af_1ea0_e984a1cd77c4
  6e9b9423_2aa1_96c1_1185_f860250923b6["applyUpdateViewTransition()"]
  585297c1_5fbc_f778_b0fa_7f11968cec48 -->|calls| 6e9b9423_2aa1_96c1_1185_f860250923b6
  style 585297c1_5fbc_f778_b0fa_7f11968cec48 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberApplyGesture.js lines 786–1021

function insertDestinationClonesOfFiber(
  finishedWork: Fiber,
  hostParentClone: Instance,
  parentViewTransition: null | ViewTransitionState,
  visitPhase: VisitPhase,
) {
  const current = finishedWork.alternate;
  if (current === null) {
    // This is a newly mounted subtree. Insert any HostComponents and trigger
    // Enter transitions.
    recursivelyInsertNewFiber(
      finishedWork,
      hostParentClone,
      parentViewTransition,
      INSERT_EXIT,
    );
    return;
  }

  const flags = finishedWork.flags;
  // The effect flag should be checked *after* we refine the type of fiber,
  // because the fiber tag is more specific. An exception is any flag related
  // to reconciliation, because those can be set on all fiber types.
  switch (finishedWork.tag) {
    case HostHoistable: {
      if (supportsResources) {
        // TODO: Hoistables should get optimistically inserted and then removed.
        recursivelyInsertClones(
          finishedWork,
          hostParentClone,
          parentViewTransition,
          visitPhase,
        );
        break;
      }
      // Fall through
    }
    case HostSingleton: {
      if (supportsSingletons) {
        recursivelyInsertClones(
          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 (flags & Update) {
            const newProps = finishedWork.memoizedProps;
            const oldProps = current.memoizedProps;
            const instance = finishedWork.stateNode;
            const type = finishedWork.type;
            const prev = pushMutationContext();

            try {
              // Since we currently don't have a separate diffing algorithm for
              // individual properties, the Update flag can be a false positive.
              // We have to apply the new props first o detect any mutations and
              // then revert them.
              commitUpdate(instance, type, oldProps, newProps, finishedWork);
              if (viewTransitionMutationContext) {
                console.error(
                  'startGestureTransition() caused something to mutate <%s>. ' +
                    'This is not possible in the current implementation. ' +
                    "Make sure that the swipe doesn't update any state which " +
                    'causes <%s> to change.',
                  finishedWork.type,
                  finishedWork.type,
                );
              }
              // Revert
              commitUpdate(instance, type, newProps, oldProps, finishedWork);
            } finally {
              popMutationContext(prev);
            }
          }
        }
        break;
      }

Domain

Subdomains

Frequently Asked Questions

What does insertDestinationClonesOfFiber() do?
insertDestinationClonesOfFiber() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberApplyGesture.js.
Where is insertDestinationClonesOfFiber() defined?
insertDestinationClonesOfFiber() is defined in packages/react-reconciler/src/ReactFiberApplyGesture.js at line 786.
What does insertDestinationClonesOfFiber() call?
insertDestinationClonesOfFiber() calls 9 function(s): applyAppearingPairViewTransition, applyExitViewTransition, applyUpdateViewTransition, popMutationContext, pushMutationContext, recursivelyInsertClones, recursivelyInsertNewFiber, trackEnterViewTransitions, and 1 more.
What calls insertDestinationClonesOfFiber()?
insertDestinationClonesOfFiber() is called by 1 function(s): recursivelyInsertClones.

Analyze Your Own Codebase

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

Try Supermodel Free