MCPcopy Index your code
hub / github.com/plotly/dash / commitLayoutEffectOnFiber

Function commitLayoutEffectOnFiber

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

Source from the content-addressed store, hash-verified

23261 }
23262
23263 function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committedLanes) {
23264 if ((finishedWork.flags & LayoutMask) !== NoFlags) {
23265 switch (finishedWork.tag) {
23266 case FunctionComponent:
23267 case ForwardRef:
23268 case SimpleMemoComponent:
23269 {
23270 if ( !offscreenSubtreeWasHidden) {
23271 // At this point layout effects have already been destroyed (during mutation phase).
23272 // This is done to prevent sibling component effects from interfering with each other,
23273 // e.g. a destroy function in one component should never override a ref set
23274 // by a create function in another component during the same commit.
23275 if ( finishedWork.mode & ProfileMode) {
23276 try {
23277 startLayoutEffectTimer();
23278 commitHookEffectListMount(Layout | HasEffect, finishedWork);
23279 } finally {
23280 recordLayoutEffectDuration(finishedWork);
23281 }
23282 } else {
23283 commitHookEffectListMount(Layout | HasEffect, finishedWork);
23284 }
23285 }
23286
23287 break;
23288 }
23289
23290 case ClassComponent:
23291 {
23292 var instance = finishedWork.stateNode;
23293
23294 if (finishedWork.flags & Update) {
23295 if (!offscreenSubtreeWasHidden) {
23296 if (current === null) {
23297 // We could update instance props and state here,
23298 // but instead we rely on them being set during last render.
23299 // TODO: revisit this when we implement resuming.
23300 {
23301 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
23302 if (instance.props !== finishedWork.memoizedProps) {
23303 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');
23304 }
23305
23306 if (instance.state !== finishedWork.memoizedState) {
23307 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');
23308 }
23309 }
23310 }
23311
23312 if ( finishedWork.mode & ProfileMode) {
23313 try {
23314 startLayoutEffectTimer();
23315 instance.componentDidMount();
23316 } finally {
23317 recordLayoutEffectDuration(finishedWork);
23318 }
23319 } else {
23320 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…