Home / Function/ trackDeletedPairViewTransitions() — react Function Reference

trackDeletedPairViewTransitions() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a67e74d5_88de_0327_6aea_26a1818af45f["trackDeletedPairViewTransitions()"]
  ee850b36_fc0b_9bb2_5b69_58d705aef9a5["ReactFiberApplyGesture.js"]
  a67e74d5_88de_0327_6aea_26a1818af45f -->|defined in| ee850b36_fc0b_9bb2_5b69_58d705aef9a5
  282c3969_f657_3d4a_7c17_9af393a5187a["trackEnterViewTransitions()"]
  282c3969_f657_3d4a_7c17_9af393a5187a -->|calls| a67e74d5_88de_0327_6aea_26a1818af45f
  be70b440_45eb_ff76_0bc6_50898635623c["getViewTransitionClassName()"]
  a67e74d5_88de_0327_6aea_26a1818af45f -->|calls| be70b440_45eb_ff76_0bc6_50898635623c
  45145b45_9179_2a0e_5b39_0f8c3bceb8c9["applyViewTransitionToClones()"]
  a67e74d5_88de_0327_6aea_26a1818af45f -->|calls| 45145b45_9179_2a0e_5b39_0f8c3bceb8c9
  style a67e74d5_88de_0327_6aea_26a1818af45f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberApplyGesture.js lines 146–211

function trackDeletedPairViewTransitions(deletion: Fiber): void {
  if (
    appearingViewTransitions === null ||
    appearingViewTransitions.size === 0
  ) {
    // We've found all.
    return;
  }
  const pairs = appearingViewTransitions;
  if ((deletion.subtreeFlags & ViewTransitionNamedStatic) === NoFlags) {
    // This has no named view transitions in its subtree.
    return;
  }
  let child = deletion.child;
  while (child !== null) {
    if (child.tag === OffscreenComponent && child.memoizedState !== null) {
      // This tree was already hidden so we skip it.
    } else {
      if (
        child.tag === ViewTransitionComponent &&
        (child.flags & ViewTransitionNamedStatic) !== NoFlags
      ) {
        const props: ViewTransitionProps = child.memoizedProps;
        const name = props.name;
        if (name != null && name !== 'auto') {
          const pair = pairs.get(name);
          if (pair !== undefined) {
            // Delete the entry so that we know when we've found all of them
            // and can stop searching (size reaches zero).
            pairs.delete(name);
            const className: ?string = getViewTransitionClassName(
              props.default,
              props.share,
            );
            if (className !== 'none') {
              // TODO: Since the deleted instance already has layout we could
              // check if it's in the viewport and if not skip the pairing.
              // It would currently cause layout thrash though so if we did that
              // we need to avoid inserting the root of the cloned trees until
              // the end.

              // The "old" instance is actually the one we're inserting.
              const oldInstance: ViewTransitionState = pair;
              // The "new" instance is the already mounted one we're deleting.
              const newInstance: ViewTransitionState = child.stateNode;
              oldInstance.paired = newInstance;
              newInstance.paired = oldInstance;
              const clones = oldInstance.clones;
              if (clones !== null) {
                // If we have clones that means that we've already visited this
                // ViewTransition boundary before and we can now apply the name
                // to those clones. Otherwise, we have to wait until we clone it.
                applyViewTransitionToClones(name, className, clones, child);
              }
            }
            if (pairs.size === 0) {
              break;
            }
          }
        }
      }
      trackDeletedPairViewTransitions(child);
    }
    child = child.sibling;
  }
}

Domain

Subdomains

Frequently Asked Questions

What does trackDeletedPairViewTransitions() do?
trackDeletedPairViewTransitions() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberApplyGesture.js.
Where is trackDeletedPairViewTransitions() defined?
trackDeletedPairViewTransitions() is defined in packages/react-reconciler/src/ReactFiberApplyGesture.js at line 146.
What does trackDeletedPairViewTransitions() call?
trackDeletedPairViewTransitions() calls 2 function(s): applyViewTransitionToClones, getViewTransitionClassName.
What calls trackDeletedPairViewTransitions()?
trackDeletedPairViewTransitions() is called by 1 function(s): trackEnterViewTransitions.

Analyze Your Own Codebase

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

Try Supermodel Free