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

Function warnIfUpdatesNotWrappedWithActDEV

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

Source from the content-addressed store, hash-verified

27603 }
27604
27605 function warnIfUpdatesNotWrappedWithActDEV(fiber) {
27606 {
27607 if (fiber.mode & ConcurrentMode) {
27608 if (!isConcurrentActEnvironment()) {
27609 // Not in an act environment. No need to warn.
27610 return;
27611 }
27612 } else {
27613 // Legacy mode has additional cases where we suppress a warning.
27614 if (!isLegacyActEnvironment()) {
27615 // Not in an act environment. No need to warn.
27616 return;
27617 }
27618
27619 if (executionContext !== NoContext) {
27620 // Legacy mode doesn't warn if the update is batched, i.e.
27621 // batchedUpdates or flushSync.
27622 return;
27623 }
27624
27625 if (fiber.tag !== FunctionComponent && fiber.tag !== ForwardRef && fiber.tag !== SimpleMemoComponent) {
27626 // For backwards compatibility with pre-hooks code, legacy mode only
27627 // warns for updates that originate from a hook.
27628 return;
27629 }
27630 }
27631
27632 if (ReactCurrentActQueue$1.current === null) {
27633 var previousFiber = current;
27634
27635 try {
27636 setCurrentFiber(fiber);
27637
27638 error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act', getComponentNameFromFiber(fiber));
27639 } finally {
27640 if (previousFiber) {
27641 setCurrentFiber(fiber);
27642 } else {
27643 resetCurrentFiber();
27644 }
27645 }
27646 }
27647 }
27648 }
27649
27650 function warnIfSuspenseResolutionNotWrappedWithActDEV(root) {
27651 {

Callers 1

scheduleUpdateOnFiberFunction · 0.70

Calls 6

isLegacyActEnvironmentFunction · 0.70
setCurrentFiberFunction · 0.70
errorFunction · 0.70
resetCurrentFiberFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…