MCPcopy Create free account
hub / github.com/reactjs/react-rails / flushPassiveEffectsImpl

Function flushPassiveEffectsImpl

lib/assets/react-source/development/react.js:26519–26583  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26517 }
26518
26519 function flushPassiveEffectsImpl() {
26520 if (rootWithPendingPassiveEffects === null) {
26521 return false;
26522 }
26523
26524 var root = rootWithPendingPassiveEffects;
26525 var expirationTime = pendingPassiveEffectsExpirationTime;
26526 rootWithPendingPassiveEffects = null;
26527 pendingPassiveEffectsExpirationTime = NoWork;
26528
26529 if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
26530 {
26531 throw Error( "Cannot flush passive effects while already rendering." );
26532 }
26533 }
26534
26535 var prevExecutionContext = executionContext;
26536 executionContext |= CommitContext;
26537 var prevInteractions = pushInteractions(root);
26538
26539 {
26540 // Note: This currently assumes there are no passive effects on the root fiber
26541 // because the root is not part of its own effect list.
26542 // This could change in the future.
26543 var _effect2 = root.current.firstEffect;
26544
26545 while (_effect2 !== null) {
26546 {
26547 setCurrentFiber(_effect2);
26548 invokeGuardedCallback(null, commitPassiveHookEffects, null, _effect2);
26549
26550 if (hasCaughtError()) {
26551 if (!(_effect2 !== null)) {
26552 {
26553 throw Error( "Should be working on an effect." );
26554 }
26555 }
26556
26557 var _error5 = clearCaughtError();
26558
26559 captureCommitPhaseError(_effect2, _error5);
26560 }
26561
26562 resetCurrentFiber();
26563 }
26564
26565 var nextNextEffect = _effect2.nextEffect; // Remove nextEffect pointer to assist GC
26566
26567 _effect2.nextEffect = null;
26568 _effect2 = nextNextEffect;
26569 }
26570 }
26571
26572 {
26573 popInteractions(prevInteractions);
26574 finishPendingInteractions(root, expirationTime);
26575 }
26576

Callers

nothing calls this directly

Calls 10

pushInteractionsFunction · 0.85
setCurrentFiberFunction · 0.85
invokeGuardedCallbackFunction · 0.85
hasCaughtErrorFunction · 0.85
clearCaughtErrorFunction · 0.85
captureCommitPhaseErrorFunction · 0.85
resetCurrentFiberFunction · 0.85
popInteractionsFunction · 0.85
flushSyncCallbackQueueFunction · 0.85

Tested by

no test coverage detected