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

Function warnAboutUpdateOnNotYetMountedFiberInDEV

dash/deps/react-dom@18.3.1.js:27414–27460  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

27412
27413 var didWarnStateUpdateForNotYetMountedComponent = null;
27414 function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) {
27415 {
27416 if ((executionContext & RenderContext) !== NoContext) {
27417 // We let the other warning about render phase updates deal with this one.
27418 return;
27419 }
27420
27421 if (!(fiber.mode & ConcurrentMode)) {
27422 return;
27423 }
27424
27425 var tag = fiber.tag;
27426
27427 if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) {
27428 // Only warn for user-defined components, not internal ones like Suspense.
27429 return;
27430 } // We show the whole stack but dedupe on the top component's name because
27431 // the problematic code almost always lies inside that component.
27432
27433
27434 var componentName = getComponentNameFromFiber(fiber) || 'ReactComponent';
27435
27436 if (didWarnStateUpdateForNotYetMountedComponent !== null) {
27437 if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) {
27438 return;
27439 }
27440
27441 didWarnStateUpdateForNotYetMountedComponent.add(componentName);
27442 } else {
27443 didWarnStateUpdateForNotYetMountedComponent = new Set([componentName]);
27444 }
27445
27446 var previousFiber = current;
27447
27448 try {
27449 setCurrentFiber(fiber);
27450
27451 error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.');
27452 } finally {
27453 if (previousFiber) {
27454 setCurrentFiber(fiber);
27455 } else {
27456 resetCurrentFiber();
27457 }
27458 }
27459 }
27460 }
27461 var beginWork$1;
27462
27463 {

Callers 1

Calls 5

setCurrentFiberFunction · 0.70
errorFunction · 0.70
resetCurrentFiberFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…