Home / Function/ commitClassCallbacks() — react Function Reference

commitClassCallbacks() — react Function Reference

Architecture documentation for the commitClassCallbacks() function in ReactFiberCommitEffects.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  1742f4ab_88cb_1f5c_9378_61760e273398["commitClassCallbacks()"]
  8f5342bb_933e_6410_b584_cc120047394a["ReactFiberCommitEffects.js"]
  1742f4ab_88cb_1f5c_9378_61760e273398 -->|defined in| 8f5342bb_933e_6410_b584_cc120047394a
  ce61aa22_42d2_811a_b317_96c8d0cb0321["commitLayoutEffectOnFiber()"]
  ce61aa22_42d2_811a_b317_96c8d0cb0321 -->|calls| 1742f4ab_88cb_1f5c_9378_61760e273398
  1846396a_6bcb_7ad4_8180_1d20ef2960a4["reappearLayoutEffects()"]
  1846396a_6bcb_7ad4_8180_1d20ef2960a4 -->|calls| 1742f4ab_88cb_1f5c_9378_61760e273398
  7f5a1eb6_175b_de57_e39a_6c9d67383c84["resolveClassComponentProps()"]
  1742f4ab_88cb_1f5c_9378_61760e273398 -->|calls| 7f5a1eb6_175b_de57_e39a_6c9d67383c84
  c4d9a9cc_f5a1_3cd7_8ada_0c662e173d45["shouldProfile()"]
  1742f4ab_88cb_1f5c_9378_61760e273398 -->|calls| c4d9a9cc_f5a1_3cd7_8ada_0c662e173d45
  fb6ac8c2_1325_f769_79fa_77c9d16252f1["getViewTransitionName()"]
  1742f4ab_88cb_1f5c_9378_61760e273398 -->|calls| fb6ac8c2_1325_f769_79fa_77c9d16252f1
  style 1742f4ab_88cb_1f5c_9378_61760e273398 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberCommitEffects.js lines 517–1044

export function commitClassCallbacks(finishedWork: Fiber) {
  // TODO: I think this is now always non-null by the time it reaches the
  // commit phase. Consider removing the type check.
  const updateQueue: UpdateQueue<mixed> | null =
    (finishedWork.updateQueue: any);
  if (updateQueue !== null) {
    const instance = finishedWork.stateNode;
    if (__DEV__) {
      if (
        !finishedWork.type.defaultProps &&
        !('ref' in finishedWork.memoizedProps) &&
        !didWarnAboutReassigningProps
      ) {
        if (instance.props !== finishedWork.memoizedProps) {
          console.error(
            'Expected %s props to match memoized props before ' +
              'processing the update queue. ' +
              'This might either be because of a bug in React, or because ' +
              'a component reassigns its own `this.props`. ' +
              'Please file an issue.',
            getComponentNameFromFiber(finishedWork) || 'instance',
          );
        }
        if (instance.state !== finishedWork.memoizedState) {
          console.error(
            'Expected %s state to match memoized state before ' +
              'processing the update queue. ' +
              'This might either be because of a bug in React, or because ' +
              'a component reassigns its own `this.state`. ' +
              'Please file an issue.',
            getComponentNameFromFiber(finishedWork) || 'instance',
          );
        }
      }
    }
    // We could update instance props and state here,
    // but instead we rely on them being set during last render.
    // TODO: revisit this when we implement resuming.
    try {
      if (__DEV__) {
        runWithFiberInDEV(finishedWork, commitCallbacks, updateQueue, instance);
      } else {
        commitCallbacks(updateQueue, instance);
      }
    } catch (error) {
      captureCommitPhaseError(finishedWork, finishedWork.return, error);
    }
  }
}

export function commitClassHiddenCallbacks(finishedWork: Fiber) {
  // Commit any callbacks that would have fired while the component
  // was hidden.
  const updateQueue: UpdateQueue<mixed> | null =
    (finishedWork.updateQueue: any);
  if (updateQueue !== null) {
    const instance = finishedWork.stateNode;
    try {
      if (__DEV__) {
        runWithFiberInDEV(
          finishedWork,
          commitHiddenCallbacks,
          updateQueue,
          instance,
        );
      } else {
        commitHiddenCallbacks(updateQueue, instance);
      }
    } catch (error) {
      captureCommitPhaseError(finishedWork, finishedWork.return, error);
    }
  }
}

export function commitRootCallbacks(finishedWork: Fiber) {
  // TODO: I think this is now always non-null by the time it reaches the
  // commit phase. Consider removing the type check.
  const updateQueue: UpdateQueue<mixed> | null =
    (finishedWork.updateQueue: any);
  if (updateQueue !== null) {
    let instance = null;

Domain

Subdomains

Frequently Asked Questions

What does commitClassCallbacks() do?
commitClassCallbacks() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberCommitEffects.js.
Where is commitClassCallbacks() defined?
commitClassCallbacks() is defined in packages/react-reconciler/src/ReactFiberCommitEffects.js at line 517.
What does commitClassCallbacks() call?
commitClassCallbacks() calls 3 function(s): getViewTransitionName, resolveClassComponentProps, shouldProfile.
What calls commitClassCallbacks()?
commitClassCallbacks() is called by 2 function(s): commitLayoutEffectOnFiber, reappearLayoutEffects.

Analyze Your Own Codebase

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

Try Supermodel Free