@@ -13,7 +13,6 @@ import type {Lanes, Lane} from './ReactFiberLane.new';
1313import type { ReactPriorityLevel } from './ReactInternalTypes' ;
1414import type { Interaction } from 'scheduler/src/Tracing' ;
1515import type { SuspenseState } from './ReactFiberSuspenseComponent.new' ;
16- import type { Effect as HookEffect } from './ReactFiberHooks.new' ;
1716import type { StackCursor } from './ReactFiberStack.new' ;
1817import type { FunctionComponentUpdateQueue } from './ReactFiberHooks.new' ;
1918
@@ -120,12 +119,11 @@ import {
120119 NoFlags ,
121120 PerformedWork ,
122121 Placement ,
123- ChildDeletion ,
124- Passive ,
125122 PassiveStatic ,
126123 Incomplete ,
127124 HostEffectMask ,
128125 Hydrating ,
126+ PassiveMask ,
129127 StaticMask ,
130128} from './ReactFiberFlags' ;
131129import {
@@ -183,7 +181,6 @@ import {
183181 commitPassiveEffectDurations ,
184182 commitPassiveMountEffects ,
185183 commitPassiveUnmountEffects ,
186- detachFiberAfterEffects ,
187184} from './ReactFiberCommitWork.new' ;
188185import { enqueueUpdate } from './ReactUpdateQueue.new' ;
189186import { resetContextDependencies } from './ReactFiberNewContext.new' ;
@@ -314,7 +311,6 @@ export function getRenderTargetTime(): number {
314311 return workInProgressRootRenderTargetTime ;
315312}
316313
317- let nextEffect: Fiber | null = null;
318314let hasUncaughtError = false;
319315let firstUncaughtError = null;
320316let legacyErrorBoundariesThatAlreadyFailed: Set< mixed > | null = null;
@@ -1938,8 +1934,8 @@ function commitRootImpl(root, renderPriorityLevel) {
19381934 // TODO: Delete all other places that schedule the passive effect callback
19391935 // They're redundant.
19401936 if (
1941- ( finishedWork . subtreeFlags & Passive ) !== NoFlags ||
1942- ( finishedWork . flags & Passive ) !== NoFlags
1937+ ( finishedWork . subtreeFlags & PassiveMask ) !== NoFlags ||
1938+ ( finishedWork . flags & PassiveMask ) !== NoFlags
19431939 ) {
19441940 if ( ! rootDoesHavePassiveEffects ) {
19451941 rootDoesHavePassiveEffects = true ;
@@ -2061,31 +2057,6 @@ function commitRootImpl(root, renderPriorityLevel) {
20612057 rootWithPendingPassiveEffects = root ;
20622058 pendingPassiveEffectsLanes = lanes ;
20632059 pendingPassiveEffectsRenderPriority = renderPriorityLevel ;
2064- } else {
2065- // We are done with the effect chain at this point so let's clear the
2066- // nextEffect pointers to assist with GC. If we have passive effects, we'll
2067- // clear this in flushPassiveEffects
2068- // TODO: We should always do this in the passive phase, by scheduling
2069- // a passive callback for every deletion.
2070- nextEffect = firstEffect ;
2071- while ( nextEffect !== null ) {
2072- const nextNextEffect = nextEffect . nextEffect ;
2073- nextEffect . nextEffect = null ;
2074- if ( nextEffect . flags & ChildDeletion ) {
2075- const deletions = nextEffect . deletions ;
2076- if ( deletions !== null ) {
2077- for ( let i = 0 ; i < deletions . length ; i ++ ) {
2078- const deletion = deletions [ i ] ;
2079- const alternate = deletion . alternate ;
2080- detachFiberAfterEffects ( deletion ) ;
2081- if ( alternate !== null ) {
2082- detachFiberAfterEffects ( alternate ) ;
2083- }
2084- }
2085- }
2086- }
2087- nextEffect = nextNextEffect ;
2088- }
20892060 }
20902061
20912062 // Read this again, since an effect might have updated it
@@ -2229,32 +2200,6 @@ export function enqueuePendingPassiveProfilerEffect(fiber: Fiber): void {
22292200 }
22302201}
22312202
2232- export function enqueuePendingPassiveHookEffectMount (
2233- fiber : Fiber ,
2234- effect : HookEffect ,
2235- ) : void {
2236- if ( ! rootDoesHavePassiveEffects ) {
2237- rootDoesHavePassiveEffects = true ;
2238- scheduleCallback ( NormalSchedulerPriority , ( ) => {
2239- flushPassiveEffects ( ) ;
2240- return null ;
2241- } ) ;
2242- }
2243- }
2244-
2245- export function enqueuePendingPassiveHookEffectUnmount (
2246- fiber : Fiber ,
2247- effect : HookEffect ,
2248- ) : void {
2249- if ( ! rootDoesHavePassiveEffects ) {
2250- rootDoesHavePassiveEffects = true ;
2251- scheduleCallback ( NormalSchedulerPriority , ( ) => {
2252- flushPassiveEffects ( ) ;
2253- return null ;
2254- } ) ;
2255- }
2256- }
2257-
22582203function flushPassiveEffectsImpl ( ) {
22592204 if ( rootWithPendingPassiveEffects === null ) {
22602205 return false ;
0 commit comments