MCPcopy Create free account
hub / github.com/plotly/dash / commitLayoutEffectOnFiber

Function commitLayoutEffectOnFiber

dash/deps/react-dom@18.3.1.js:23302–23556  ·  view source on GitHub ↗
(finishedRoot, current, finishedWork, committedLanes)

Source from the content-addressed store, hash-verified

23300 }
23301
23302 function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committedLanes) {
23303 if ((finishedWork.flags & LayoutMask) !== NoFlags) {
23304 switch (finishedWork.tag) {
23305 case FunctionComponent:
23306 case ForwardRef:
23307 case SimpleMemoComponent:
23308 {
23309 if ( !offscreenSubtreeWasHidden) {
23310 // At this point layout effects have already been destroyed (during mutation phase).
23311 // This is done to prevent sibling component effects from interfering with each other,
23312 // e.g. a destroy function in one component should never override a ref set
23313 // by a create function in another component during the same commit.
23314 if ( finishedWork.mode & ProfileMode) {
23315 try {
23316 startLayoutEffectTimer();
23317 commitHookEffectListMount(Layout | HasEffect, finishedWork);
23318 } finally {
23319 recordLayoutEffectDuration(finishedWork);
23320 }
23321 } else {
23322 commitHookEffectListMount(Layout | HasEffect, finishedWork);
23323 }
23324 }
23325
23326 break;
23327 }
23328
23329 case ClassComponent:
23330 {
23331 var instance = finishedWork.stateNode;
23332
23333 if (finishedWork.flags & Update) {
23334 if (!offscreenSubtreeWasHidden) {
23335 if (current === null) {
23336 // We could update instance props and state here,
23337 // but instead we rely on them being set during last render.
23338 // TODO: revisit this when we implement resuming.
23339 {
23340 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
23341 if (instance.props !== finishedWork.memoizedProps) {
23342 error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + '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');
23343 }
23344
23345 if (instance.state !== finishedWork.memoizedState) {
23346 error('Expected %s state to match memoized state before ' + 'componentDidMount. ' + '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');
23347 }
23348 }
23349 }
23350
23351 if ( finishedWork.mode & ProfileMode) {
23352 try {
23353 startLayoutEffectTimer();
23354 instance.componentDidMount();
23355 } finally {
23356 recordLayoutEffectDuration(finishedWork);
23357 }
23358 } else {
23359 instance.componentDidMount();

Callers 1

Calls 15

startLayoutEffectTimerFunction · 0.70
errorFunction · 0.70
resolveDefaultPropsFunction · 0.70
commitUpdateQueueFunction · 0.70
getPublicInstanceFunction · 0.70
commitMountFunction · 0.70
getCommitTimeFunction · 0.70
isCurrentUpdateNestedFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…