()
| 27015 | } |
| 27016 | |
| 27017 | function flushPassiveEffectsImpl() { |
| 27018 | if (rootWithPendingPassiveEffects === null) { |
| 27019 | return false; |
| 27020 | } // Cache and clear the transitions flag |
| 27021 | |
| 27022 | |
| 27023 | var transitions = pendingPassiveTransitions; |
| 27024 | pendingPassiveTransitions = null; |
| 27025 | var root = rootWithPendingPassiveEffects; |
| 27026 | var lanes = pendingPassiveEffectsLanes; |
| 27027 | rootWithPendingPassiveEffects = null; // TODO: This is sometimes out of sync with rootWithPendingPassiveEffects. |
| 27028 | // Figure out why and fix it. It's not causing any known issues (probably |
| 27029 | // because it's only used for profiling), but it's a refactor hazard. |
| 27030 | |
| 27031 | pendingPassiveEffectsLanes = NoLanes; |
| 27032 | |
| 27033 | if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { |
| 27034 | throw new Error('Cannot flush passive effects while already rendering.'); |
| 27035 | } |
| 27036 | |
| 27037 | { |
| 27038 | isFlushingPassiveEffects = true; |
| 27039 | didScheduleUpdateDuringPassiveEffects = false; |
| 27040 | } |
| 27041 | |
| 27042 | { |
| 27043 | markPassiveEffectsStarted(lanes); |
| 27044 | } |
| 27045 | |
| 27046 | var prevExecutionContext = executionContext; |
| 27047 | executionContext |= CommitContext; |
| 27048 | commitPassiveUnmountEffects(root.current); |
| 27049 | commitPassiveMountEffects(root, root.current, lanes, transitions); // TODO: Move to commitPassiveMountEffects |
| 27050 | |
| 27051 | { |
| 27052 | var profilerEffects = pendingPassiveProfilerEffects; |
| 27053 | pendingPassiveProfilerEffects = []; |
| 27054 | |
| 27055 | for (var i = 0; i < profilerEffects.length; i++) { |
| 27056 | var _fiber = profilerEffects[i]; |
| 27057 | commitPassiveEffectDurations(root, _fiber); |
| 27058 | } |
| 27059 | } |
| 27060 | |
| 27061 | { |
| 27062 | markPassiveEffectsStopped(); |
| 27063 | } |
| 27064 | |
| 27065 | { |
| 27066 | commitDoubleInvokeEffectsInDEV(root.current, true); |
| 27067 | } |
| 27068 | |
| 27069 | executionContext = prevExecutionContext; |
| 27070 | flushSyncCallbacks(); |
| 27071 | |
| 27072 | { |
| 27073 | // If additional passive effects were scheduled, increment a counter. If this |
| 27074 | // exceeds the limit, we'll fire a warning. |
no test coverage detected
searching dependent graphs…