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

Function warnAboutRenderPhaseUpdatesInDEV

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

Source from the content-addressed store, hash-verified

27523 }
27524
27525 function warnAboutRenderPhaseUpdatesInDEV(fiber) {
27526 {
27527 if (isRendering && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) {
27528 switch (fiber.tag) {
27529 case FunctionComponent:
27530 case ForwardRef:
27531 case SimpleMemoComponent:
27532 {
27533 var renderingComponentName = workInProgress && getComponentNameFromFiber(workInProgress) || 'Unknown'; // Dedupe by the rendering component because it's the one that needs to be fixed.
27534
27535 var dedupeKey = renderingComponentName;
27536
27537 if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) {
27538 didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey);
27539 var setStateComponentName = getComponentNameFromFiber(fiber) || 'Unknown';
27540
27541 error('Cannot update a component (`%s`) while rendering a ' + 'different component (`%s`). To locate the bad setState() call inside `%s`, ' + 'follow the stack trace as described in https://reactjs.org/link/setstate-in-render', setStateComponentName, renderingComponentName, renderingComponentName);
27542 }
27543
27544 break;
27545 }
27546
27547 case ClassComponent:
27548 {
27549 if (!didWarnAboutUpdateInRender) {
27550 error('Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure ' + 'function of props and state.');
27551
27552 didWarnAboutUpdateInRender = true;
27553 }
27554
27555 break;
27556 }
27557 }
27558 }
27559 }
27560 }
27561
27562 function restorePendingUpdaters(root, lanes) {
27563 {

Callers 1

scheduleUpdateOnFiberFunction · 0.70

Calls 4

errorFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…