Rename effect fields (#19755)
- `effectTag` -> `flags` - `subtreeTag` -> `subtreeFlags`
Andrew Clark committed
Sep 4, 2020 at 16:34 UTC
16654436039dd8f16a63928e71081c7745872e8f
39 files changed
+464
-468
.eslintrc.js
+1
-1
@@ -117,7 +117,7 @@ module.exports = {
117
// Disabled because it's also used by the Hook type.
118
// 'lastEffect',
119
],
120
- new: ['subtreeTag'],
120
+ new: ['subtreeFlags'],
121
},
122
],
123
},
fixtures/fiber-debugger/src/Fibers.js
+2
-2
@@ -324,9 +324,9 @@ export default function Fibers({fibers, show, graphSettings, ...rest}) {
324
) : (
325
<small>Committed</small>
326
)}
327
- {fiber.effectTag && [
327
+ {fiber.flags && [
328
<br key="br" />,
329
- <small key="small">Effect: {fiber.effectTag}</small>,
329
+ <small key="small">Effect: {fiber.flags}</small>,
330
]}
331
</div>
332
</Vertex>,
fixtures/fiber-debugger/src/describeFibers.js
+3
-3
@@ -37,7 +37,7 @@ function getFriendlyTag(tag) {
37
}
38
}
39
40
-function getFriendlyEffect(effectTag) {
40
+function getFriendlyEffect(flags) {
41
const effects = {
42
1: 'Performed Work',
43
2: 'Placement',
@@ -49,7 +49,7 @@ function getFriendlyEffect(effectTag) {
49
128: 'Ref',
50
};
51
return Object.keys(effects)
52
- .filter(flag => flag & effectTag)
52
+ .filter(flag => flag & flags)
53
.map(flag => effects[flag])
54
.join(' & ');
55
}
@@ -72,7 +72,7 @@ export default function describeFibers(rootFiber, workInProgress) {
72
...fiber,
73
id: id,
74
tag: getFriendlyTag(fiber.tag),
75
- effectTag: getFriendlyEffect(fiber.effectTag),
75
+ flags: getFriendlyEffect(fiber.flags),
76
type: fiber.type && '<' + (fiber.type.name || fiber.type) + '>',
77
stateNode: `[${typeof fiber.stateNode}]`,
78
return: acknowledgeFiber(fiber.return),
packages/react-devtools-shared/src/backend/renderer.js
+11
-6
@@ -106,11 +106,16 @@ type ReactPriorityLevelsType = {|
106
|};
107
108
type ReactTypeOfSideEffectType = {|
109
- NoEffect: number,
109
+ NoFlags: number,
110
PerformedWork: number,
111
Placement: number,
112
|};
113
114
+function getFiberFlags(fiber: Fiber): number {
115
+ // The name of this field changed from "effectTag" to "flags"
116
+ return fiber.flags !== undefined ? fiber.flags : (fiber: any).effectTag;
117
+}
118
+
119
// Some environments (e.g. React Native / Hermes) don't support the performance API yet.
120
const getCurrentTime =
121
typeof performance === 'object' && typeof performance.now === 'function'
@@ -127,7 +132,7 @@ export function getInternalReactConstants(
132
ReactTypeOfWork: WorkTagMap,
133
|} {
134
const ReactTypeOfSideEffect: ReactTypeOfSideEffectType = {
130
- NoEffect: 0b00,
135
+ NoFlags: 0b00,
136
PerformedWork: 0b01,
137
Placement: 0b10,
138
};
@@ -416,7 +421,7 @@ export function attach(
421
ReactTypeOfWork,
422
ReactTypeOfSideEffect,
423
} = getInternalReactConstants(renderer.version);
419
- const {NoEffect, PerformedWork, Placement} = ReactTypeOfSideEffect;
424
+ const {NoFlags, PerformedWork, Placement} = ReactTypeOfSideEffect;
425
const {
426
FunctionComponent,
427
ClassComponent,
@@ -944,7 +949,7 @@ export function attach(
949
// For types that execute user code, we check PerformedWork effect.
950
// We don't reflect bailouts (either referential or sCU) in DevTools.
951
// eslint-disable-next-line no-bitwise
947
- return (nextFiber.effectTag & PerformedWork) === PerformedWork;
952
+ return (getFiberFlags(nextFiber) & PerformedWork) === PerformedWork;
953
// Note: ContextConsumer only gets PerformedWork effect in 16.3.3+
954
// so it won't get highlighted with React 16.3.0 to 16.3.2.
955
default:
@@ -1928,12 +1933,12 @@ export function attach(
1933
if (!fiber.alternate) {
1934
// If there is no alternate, this might be a new tree that isn't inserted
1935
// yet. If it is, then it will have a pending insertion effect on it.
1931
- if ((node.effectTag & Placement) !== NoEffect) {
1936
+ if ((getFiberFlags(node) & Placement) !== NoFlags) {
1937
return MOUNTING;
1938
}
1939
while (node.return) {
1940
node = node.return;
1936
- if ((node.effectTag & Placement) !== NoEffect) {
1941
+ if ((getFiberFlags(node) & Placement) !== NoFlags) {
1942
return MOUNTING;
1943
}
1944
}
packages/react-devtools-shared/src/backend/types.js
+1
-1
@@ -22,7 +22,7 @@ type BundleType =
22
| 1; // DEV
23
24
export type WorkTag = number;
25
-export type SideEffectTag = number;
25
+export type WorkFlags = number;
26
export type ExpirationTime = number;
27
28
export type WorkTagMap = {|
packages/react-reconciler/src/ReactChildFiber.new.js
+5
-5
@@ -15,7 +15,7 @@ import type {Fiber} from './ReactInternalTypes';
15
import type {Lanes} from './ReactFiberLane';
16
17
import getComponentName from 'shared/getComponentName';
18
-import {Deletion, Placement} from './ReactSideEffectTags';
18
+import {Deletion, Placement} from './ReactFiberFlags';
19
import {
20
getIteratorFn,
21
REACT_ELEMENT_TYPE,
@@ -280,7 +280,7 @@ function ChildReconciler(shouldTrackSideEffects) {
280
const deletions = returnFiber.deletions;
281
if (deletions === null) {
282
returnFiber.deletions = [childToDelete];
283
- returnFiber.effectTag |= Deletion;
283
+ returnFiber.flags |= Deletion;
284
} else {
285
deletions.push(childToDelete);
286
}
@@ -350,7 +350,7 @@ function ChildReconciler(shouldTrackSideEffects) {
350
const oldIndex = current.index;
351
if (oldIndex < lastPlacedIndex) {
352
// This is a move.
353
- newFiber.effectTag = Placement;
353
+ newFiber.flags = Placement;
354
return lastPlacedIndex;
355
} else {
356
// This item can stay in place.
@@ -358,7 +358,7 @@ function ChildReconciler(shouldTrackSideEffects) {
358
}
359
} else {
360
// This is an insertion.
361
- newFiber.effectTag = Placement;
361
+ newFiber.flags = Placement;
362
return lastPlacedIndex;
363
}
364
}
@@ -367,7 +367,7 @@ function ChildReconciler(shouldTrackSideEffects) {
367
// This is simpler for the single child case. We only need to do a
368
// placement for inserting new children.
369
if (shouldTrackSideEffects && newFiber.alternate === null) {
370
- newFiber.effectTag = Placement;
370
+ newFiber.flags = Placement;
371
}
372
return newFiber;
373
}
packages/react-reconciler/src/ReactChildFiber.old.js
+5
-5
@@ -15,7 +15,7 @@ import type {Fiber} from './ReactInternalTypes';
15
import type {Lanes} from './ReactFiberLane';
16
17
import getComponentName from 'shared/getComponentName';
18
-import {Placement, Deletion} from './ReactSideEffectTags';
18
+import {Placement, Deletion} from './ReactFiberFlags';
19
import {
20
getIteratorFn,
21
REACT_ELEMENT_TYPE,
@@ -290,7 +290,7 @@ function ChildReconciler(shouldTrackSideEffects) {
290
returnFiber.firstEffect = returnFiber.lastEffect = childToDelete;
291
}
292
childToDelete.nextEffect = null;
293
- childToDelete.effectTag = Deletion;
293
+ childToDelete.flags = Deletion;
294
}
295
296
function deleteRemainingChildren(
@@ -357,7 +357,7 @@ function ChildReconciler(shouldTrackSideEffects) {
357
const oldIndex = current.index;
358
if (oldIndex < lastPlacedIndex) {
359
// This is a move.
360
- newFiber.effectTag = Placement;
360
+ newFiber.flags = Placement;
361
return lastPlacedIndex;
362
} else {
363
// This item can stay in place.
@@ -365,7 +365,7 @@ function ChildReconciler(shouldTrackSideEffects) {
365
}
366
} else {
367
// This is an insertion.
368
- newFiber.effectTag = Placement;
368
+ newFiber.flags = Placement;
369
return lastPlacedIndex;
370
}
371
}
@@ -374,7 +374,7 @@ function ChildReconciler(shouldTrackSideEffects) {
374
// This is simpler for the single child case. We only need to do a
375
// placement for inserting new children.
376
if (shouldTrackSideEffects && newFiber.alternate === null) {
377
- newFiber.effectTag = Placement;
377
+ newFiber.flags = Placement;
378
}
379
return newFiber;
380
}
packages/react-reconciler/src/ReactFiber.new.js
+11
-11
@@ -29,8 +29,8 @@ import {
29
enableScopeAPI,
30
enableBlocksAPI,
31
} from 'shared/ReactFeatureFlags';
32
-import {NoEffect, Placement, StaticMask} from './ReactSideEffectTags';
33
-import {NoEffect as NoSubtreeEffect} from './ReactSubtreeTags';
32
+import {NoFlags, Placement, StaticMask} from './ReactFiberFlags';
33
+import {NoFlags as NoSubtreeEffect} from './ReactSubtreeFlags';
34
import {ConcurrentRoot, BlockingRoot} from './ReactRootTags';
35
import {
36
IndeterminateComponent,
@@ -144,8 +144,8 @@ function FiberNode(
144
this.mode = mode;
145
146
// Effects
147
- this.effectTag = NoEffect;
148
- this.subtreeTag = NoSubtreeEffect;
147
+ this.flags = NoFlags;
148
+ this.subtreeFlags = NoSubtreeEffect;
149
this.deletions = null;
150
151
this.lanes = NoLanes;
@@ -284,7 +284,7 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
284
workInProgress.type = current.type;
285
286
// We already have an alternate.
287
- workInProgress.subtreeTag = NoSubtreeEffect;
287
+ workInProgress.subtreeFlags = NoSubtreeEffect;
288
workInProgress.deletions = null;
289
290
if (enableProfilerTimer) {
@@ -299,7 +299,7 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
299
300
// Reset all effects except static ones.
301
// Static effects are not specific to a render.
302
- workInProgress.effectTag = current.effectTag & StaticMask;
302
+ workInProgress.flags = current.flags & StaticMask;
303
workInProgress.childLanes = current.childLanes;
304
workInProgress.lanes = current.lanes;
305
@@ -363,7 +363,7 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
363
364
// Reset the effect tag but keep any Placement tags, since that's something
365
// that child fiber is setting, not the reconciliation.
366
- workInProgress.effectTag &= Placement;
366
+ workInProgress.flags &= Placement;
367
368
const current = workInProgress.alternate;
369
if (current === null) {
@@ -372,7 +372,7 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
372
workInProgress.lanes = renderLanes;
373
374
workInProgress.child = null;
375
- workInProgress.subtreeTag = NoSubtreeEffect;
375
+ workInProgress.subtreeFlags = NoSubtreeEffect;
376
workInProgress.memoizedProps = null;
377
workInProgress.memoizedState = null;
378
workInProgress.updateQueue = null;
@@ -393,7 +393,7 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
393
workInProgress.lanes = current.lanes;
394
395
workInProgress.child = current.child;
396
- workInProgress.subtreeTag = current.subtreeTag;
396
+ workInProgress.subtreeFlags = current.subtreeFlags;
397
workInProgress.deletions = null;
398
workInProgress.memoizedProps = current.memoizedProps;
399
workInProgress.memoizedState = current.memoizedState;
@@ -816,8 +816,8 @@ export function assignFiberPropertiesInDEV(
816
target.memoizedState = source.memoizedState;
817
target.dependencies = source.dependencies;
818
target.mode = source.mode;
819
- target.effectTag = source.effectTag;
820
- target.subtreeTag = source.subtreeTag;
819
+ target.flags = source.flags;
820
+ target.subtreeFlags = source.subtreeFlags;
821
target.deletions = source.deletions;
822
target.lanes = source.lanes;
823
target.childLanes = source.childLanes;
packages/react-reconciler/src/ReactFiber.old.js
+5
-5
@@ -29,7 +29,7 @@ import {
29
enableScopeAPI,
30
enableBlocksAPI,
31
} from 'shared/ReactFeatureFlags';
32
-import {NoEffect, Placement} from './ReactSideEffectTags';
32
+import {NoFlags, Placement} from './ReactFiberFlags';
33
import {ConcurrentRoot, BlockingRoot} from './ReactRootTags';
34
import {
35
IndeterminateComponent,
@@ -143,7 +143,7 @@ function FiberNode(
143
this.mode = mode;
144
145
// Effects
146
- this.effectTag = NoEffect;
146
+ this.flags = NoFlags;
147
this.nextEffect = null;
148
149
this.firstEffect = null;
@@ -286,7 +286,7 @@ export function createWorkInProgress(current: Fiber, pendingProps: any): Fiber {
286
287
// We already have an alternate.
288
// Reset the effect tag.
289
- workInProgress.effectTag = NoEffect;
289
+ workInProgress.flags = NoFlags;
290
291
// The effect list is no longer valid.
292
workInProgress.nextEffect = null;
@@ -366,7 +366,7 @@ export function resetWorkInProgress(workInProgress: Fiber, renderLanes: Lanes) {
366
367
// Reset the effect tag but keep any Placement tags, since that's something
368
// that child fiber is setting, not the reconciliation.
369
- workInProgress.effectTag &= Placement;
369
+ workInProgress.flags &= Placement;
370
371
// The effect list is no longer valid.
372
workInProgress.nextEffect = null;
@@ -821,7 +821,7 @@ export function assignFiberPropertiesInDEV(
821
target.memoizedState = source.memoizedState;
822
target.dependencies = source.dependencies;
823
target.mode = source.mode;
824
- target.effectTag = source.effectTag;
824
+ target.flags = source.flags;
825
target.nextEffect = source.nextEffect;
826
target.firstEffect = source.firstEffect;
827
target.lastEffect = source.lastEffect;
packages/react-reconciler/src/ReactFiberBeginWork.new.js
+38
-42
@@ -54,7 +54,7 @@ import {
54
LegacyHiddenComponent,
55
} from './ReactWorkTags';
56
import {
57
- NoEffect,
57
+ NoFlags,
58
PerformedWork,
59
Placement,
60
Hydrating,
@@ -64,7 +64,7 @@ import {
64
Ref,
65
Deletion,
66
ForceUpdateForLegacySuspense,
67
-} from './ReactSideEffectTags';
67
+} from './ReactFiberFlags';
68
import ReactSharedInternals from 'shared/ReactSharedInternals';
69
import {
70
debugRenderPhaseSideEffectsForStrictMode,
@@ -375,7 +375,7 @@ function updateForwardRef(
375
}
376
377
// React DevTools reads this flag.
378
- workInProgress.effectTag |= PerformedWork;
378
+ workInProgress.flags |= PerformedWork;
379
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
380
return workInProgress.child;
381
}
@@ -470,7 +470,7 @@ function updateMemoComponent(
470
}
471
}
472
// React DevTools reads this flag.
473
- workInProgress.effectTag |= PerformedWork;
473
+ workInProgress.flags |= PerformedWork;
474
const newChild = createWorkInProgress(currentChild, nextProps);
475
newChild.ref = workInProgress.ref;
476
newChild.return = workInProgress;
@@ -549,10 +549,7 @@ function updateSimpleMemoComponent(
549
workInProgress,
550
renderLanes,
551
);
552
- } else if (
553
- (current.effectTag & ForceUpdateForLegacySuspense) !==
554
- NoEffect
555
- ) {
552
+ } else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
553
// This is a special case that only exists for legacy mode.
554
// See https://github.com/facebook/react/pull/19216.
555
didReceiveUpdate = true;
@@ -676,7 +673,7 @@ function updateProfiler(
673
renderLanes: Lanes,
674
) {
675
if (enableProfilerTimer) {
679
- workInProgress.effectTag |= Update;
676
+ workInProgress.flags |= Update;
677
678
// Reset effect durations for the next eventual effect phase.
679
// These are reset during render to allow the DevTools commit hook a chance to read them,
@@ -697,7 +694,7 @@ function markRef(current: Fiber | null, workInProgress: Fiber) {
694
(current !== null && current.ref !== ref)
695
) {
696
// Schedule a Ref effect
700
- workInProgress.effectTag |= Ref;
697
+ workInProgress.flags |= Ref;
698
}
699
}
700
@@ -779,7 +776,7 @@ function updateFunctionComponent(
776
}
777
778
// React DevTools reads this flag.
782
- workInProgress.effectTag |= PerformedWork;
779
+ workInProgress.flags |= PerformedWork;
780
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
781
return workInProgress.child;
782
}
@@ -848,7 +845,7 @@ function updateBlock<Props, Data>(
845
}
846
847
// React DevTools reads this flag.
851
- workInProgress.effectTag |= PerformedWork;
848
+ workInProgress.flags |= PerformedWork;
849
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
850
return workInProgress.child;
851
}
@@ -899,7 +896,7 @@ function updateClassComponent(
896
current.alternate = null;
897
workInProgress.alternate = null;
898
// Since this is conceptually a new fiber, schedule a Placement effect
902
- workInProgress.effectTag |= Placement;
899
+ workInProgress.flags |= Placement;
900
}
901
// In the initial pass we might need to construct the instance.
902
constructClassInstance(workInProgress, Component, nextProps);
@@ -957,7 +954,7 @@ function finishClassComponent(
954
// Refs should update even if shouldComponentUpdate returns false
955
markRef(current, workInProgress);
956
960
- const didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
957
+ const didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags;
958
959
if (!shouldUpdate && !didCaptureError) {
960
// Context providers should defer to sCU for rendering
@@ -1009,7 +1006,7 @@ function finishClassComponent(
1006
}
1007
1008
// React DevTools reads this flag.
1012
- workInProgress.effectTag |= PerformedWork;
1009
+ workInProgress.flags |= PerformedWork;
1010
if (current !== null && didCaptureError) {
1011
// If we're recovering from an error, reconcile without reusing any of
1012
// the existing children. Conceptually, the normal children and the children
@@ -1111,7 +1108,7 @@ function updateHostRoot(current, workInProgress, renderLanes) {
1108
// Conceptually this is similar to Placement in that a new subtree is
1109
// inserted into the React tree here. It just happens to not need DOM
1110
// mutations because it already exists.
1114
- node.effectTag = (node.effectTag & ~Placement) | Hydrating;
1111
+ node.flags = (node.flags & ~Placement) | Hydrating;
1112
node = node.sibling;
1113
}
1114
} else {
@@ -1150,7 +1147,7 @@ function updateHostComponent(
1147
} else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
1148
// If we're switching from a direct text child to a normal child, or to
1149
// empty, we need to schedule the text content to be reset.
1153
- workInProgress.effectTag |= ContentReset;
1150
+ workInProgress.flags |= ContentReset;
1151
}
1152
1153
markRef(current, workInProgress);
@@ -1182,7 +1179,7 @@ function mountLazyComponent(
1179
_current.alternate = null;
1180
workInProgress.alternate = null;
1181
// Since this is conceptually a new fiber, schedule a Placement effect
1185
- workInProgress.effectTag |= Placement;
1182
+ workInProgress.flags |= Placement;
1183
}
1184
1185
const props = workInProgress.pendingProps;
@@ -1318,7 +1315,7 @@ function mountIncompleteClassComponent(
1315
_current.alternate = null;
1316
workInProgress.alternate = null;
1317
// Since this is conceptually a new fiber, schedule a Placement effect
1321
- workInProgress.effectTag |= Placement;
1318
+ workInProgress.flags |= Placement;
1319
}
1320
1321
// Promote the fiber to a class and try rendering again.
@@ -1365,7 +1362,7 @@ function mountIndeterminateComponent(
1362
_current.alternate = null;
1363
workInProgress.alternate = null;
1364
// Since this is conceptually a new fiber, schedule a Placement effect
1368
- workInProgress.effectTag |= Placement;
1365
+ workInProgress.flags |= Placement;
1366
}
1367
1368
const props = workInProgress.pendingProps;
@@ -1426,7 +1423,7 @@ function mountIndeterminateComponent(
1423
);
1424
}
1425
// React DevTools reads this flag.
1429
- workInProgress.effectTag |= PerformedWork;
1426
+ workInProgress.flags |= PerformedWork;
1427
1428
if (__DEV__) {
1429
// Support for module components is deprecated and is removed behind a flag.
@@ -1698,14 +1695,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
1695
// This is used by DevTools to force a boundary to suspend.
1696
if (__DEV__) {
1697
if (shouldSuspend(workInProgress)) {
1701
- workInProgress.effectTag |= DidCapture;
1698
+ workInProgress.flags |= DidCapture;
1699
}
1700
}
1701
1702
let suspenseContext: SuspenseContext = suspenseStackCursor.current;
1703
1704
let showFallback = false;
1708
- const didSuspend = (workInProgress.effectTag & DidCapture) !== NoEffect;
1705
+ const didSuspend = (workInProgress.flags & DidCapture) !== NoFlags;
1706
1707
if (
1708
didSuspend ||
@@ -1719,7 +1716,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
1716
// Something in this boundary's subtree already suspended. Switch to
1717
// rendering the fallback children.
1718
showFallback = true;
1722
- workInProgress.effectTag &= ~DidCapture;
1719
+ workInProgress.flags &= ~DidCapture;
1720
} else {
1721
// Attempting the main content
1722
if (
@@ -1844,7 +1841,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
1841
workInProgress.child = current.child;
1842
// The dehydrated completion pass expects this flag to be there
1843
// but the normal suspense pass doesn't.
1847
- workInProgress.effectTag |= DidCapture;
1844
+ workInProgress.flags |= DidCapture;
1845
return null;
1846
} else {
1847
// Suspended but we should no longer be in dehydrated mode.
@@ -2067,7 +2064,7 @@ function updateSuspensePrimaryChildren(
2064
if (deletions === null) {
2065
workInProgress.deletions = [currentFallbackChildFragment];
2066
// TODO (effects) Rename this to better reflect its new usage (e.g. ChildDeletions)
2070
- workInProgress.effectTag |= Deletion;
2067
+ workInProgress.flags |= Deletion;
2068
} else {
2069
deletions.push(currentFallbackChildFragment);
2070
}
@@ -2150,7 +2147,7 @@ function updateSuspenseFallbackChildren(
2147
);
2148
// Needs a placement effect because the parent (the Suspense boundary) already
2149
// mounted but this is a new fiber.
2153
- fallbackChildFragment.effectTag |= Placement;
2150
+ fallbackChildFragment.flags |= Placement;
2151
}
2152
2153
fallbackChildFragment.return = workInProgress;
@@ -2179,7 +2176,7 @@ function retrySuspenseComponentWithoutHydrating(
2176
);
2177
// Needs a placement effect because the parent (the Suspense boundary) already
2178
// mounted but this is a new fiber.
2182
- primaryChildFragment.effectTag |= Placement;
2179
+ primaryChildFragment.flags |= Placement;
2180
workInProgress.memoizedState = null;
2181
2182
return primaryChildFragment;
@@ -2207,7 +2204,7 @@ function mountSuspenseFallbackAfterRetryWithoutHydrating(
2204
);
2205
// Needs a placement effect because the parent (the Suspense
2206
// boundary) already mounted but this is a new fiber.
2210
- fallbackChildFragment.effectTag |= Placement;
2207
+ fallbackChildFragment.flags |= Placement;
2208
2209
primaryChildFragment.return = workInProgress;
2210
fallbackChildFragment.return = workInProgress;
@@ -2360,7 +2357,7 @@ function updateDehydratedSuspenseComponent(
2357
// on the client than if we just leave it alone. If the server times out or errors
2358
// these should update this boundary to the permanent Fallback state instead.
2359
// Mark it as having captured (i.e. suspended).
2363
- workInProgress.effectTag |= DidCapture;
2360
+ workInProgress.flags |= DidCapture;
2361
// Leave the child in place. I.e. the dehydrated fragment.
2362
workInProgress.child = current.child;
2363
// Register a callback to retry this boundary once the server has sent the result.
@@ -2389,7 +2386,7 @@ function updateDehydratedSuspenseComponent(
2386
// Conceptually this is similar to Placement in that a new subtree is
2387
// inserted into the React tree here. It just happens to not need DOM
2388
// mutations because it already exists.
2392
- primaryChildFragment.effectTag |= Hydrating;
2389
+ primaryChildFragment.flags |= Hydrating;
2390
return primaryChildFragment;
2391
}
2392
}
@@ -2675,10 +2672,10 @@ function updateSuspenseListComponent(
2672
suspenseContext,
2673
ForceSuspenseFallback,
2674
);
2678
- workInProgress.effectTag |= DidCapture;
2675
+ workInProgress.flags |= DidCapture;
2676
} else {
2677
const didSuspendBefore =
2681
- current !== null && (current.effectTag & DidCapture) !== NoEffect;
2678
+ current !== null && (current.flags & DidCapture) !== NoFlags;
2679
if (didSuspendBefore) {
2680
// If we previously forced a fallback, we need to schedule work
2681
// on any nested boundaries to let them know to try to render
@@ -2918,7 +2915,7 @@ function updateContextConsumer(
2915
}
2916
2917
// React DevTools reads this flag.
2921
- workInProgress.effectTag |= PerformedWork;
2918
+ workInProgress.flags |= PerformedWork;
2919
reconcileChildren(current, workInProgress, newChildren, renderLanes);
2920
return workInProgress.child;
2921
}
@@ -3023,12 +3020,12 @@ function remountFiber(
3020
if (deletions === null) {
3021
returnFiber.deletions = [current];
3022
// TODO (effects) Rename this to better reflect its new usage (e.g. ChildDeletions)
3026
- returnFiber.effectTag |= Deletion;
3023
+ returnFiber.flags |= Deletion;
3024
} else {
3025
deletions.push(current);
3026
}
3027
3031
- newWorkInProgress.effectTag |= Placement;
3028
+ newWorkInProgress.flags |= Placement;
3029
3030
// Restart work from the new fiber.
3031
return newWorkInProgress;
@@ -3117,7 +3114,7 @@ function beginWork(
3114
workInProgress.childLanes,
3115
);
3116
if (hasChildWork) {
3120
- workInProgress.effectTag |= Update;
3117
+ workInProgress.flags |= Update;
3118
}
3119
3120
// Reset effect durations for the next eventual effect phase.
@@ -3139,7 +3136,7 @@ function beginWork(
3136
// We know that this component will suspend again because if it has
3137
// been unsuspended it has committed as a resolved Suspense component.
3138
// If it needs to be retried, it should have work scheduled on it.
3142
- workInProgress.effectTag |= DidCapture;
3139
+ workInProgress.flags |= DidCapture;
3140
// We should never render the children of a dehydrated boundary until we
3141
// upgrade it. We return null instead of bailoutOnAlreadyFinishedWork.
3142
return null;
@@ -3191,8 +3188,7 @@ function beginWork(
3188
break;
3189
}
3190
case SuspenseListComponent: {
3194
- const didSuspendBefore =
3195
- (current.effectTag & DidCapture) !== NoEffect;
3191
+ const didSuspendBefore = (current.flags & DidCapture) !== NoFlags;
3192
3193
const hasChildWork = includesSomeLane(
3194
renderLanes,
@@ -3215,7 +3211,7 @@ function beginWork(
3211
// If none of the children had any work, that means that none of
3212
// them got retried so they'll still be blocked in the same way
3213
// as before. We can fast bail out.
3218
- workInProgress.effectTag |= DidCapture;
3214
+ workInProgress.flags |= DidCapture;
3215
}
3216
3217
// If nothing suspended before and we're rendering the same children,
@@ -3255,7 +3251,7 @@ function beginWork(
3251
}
3252
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
3253
} else {
3258
- if ((current.effectTag & ForceUpdateForLegacySuspense) !== NoEffect) {
3254
+ if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
3255
// This is a special case that only exists for legacy mode.
3256
// See https://github.com/facebook/react/pull/19216.
3257
didReceiveUpdate = true;
packages/react-reconciler/src/ReactFiberBeginWork.old.js
+38
-42
@@ -54,7 +54,7 @@ import {
54
LegacyHiddenComponent,
55
} from './ReactWorkTags';
56
import {
57
- NoEffect,
57
+ NoFlags,
58
PerformedWork,
59
Placement,
60
Hydrating,
@@ -64,7 +64,7 @@ import {
64
Ref,
65
Deletion,
66
ForceUpdateForLegacySuspense,
67
-} from './ReactSideEffectTags';
67
+} from './ReactFiberFlags';
68
import ReactSharedInternals from 'shared/ReactSharedInternals';
69
import {
70
debugRenderPhaseSideEffectsForStrictMode,
@@ -375,7 +375,7 @@ function updateForwardRef(
375
}
376
377
// React DevTools reads this flag.
378
- workInProgress.effectTag |= PerformedWork;
378
+ workInProgress.flags |= PerformedWork;
379
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
380
return workInProgress.child;
381
}
@@ -470,7 +470,7 @@ function updateMemoComponent(
470
}
471
}
472
// React DevTools reads this flag.
473
- workInProgress.effectTag |= PerformedWork;
473
+ workInProgress.flags |= PerformedWork;
474
const newChild = createWorkInProgress(currentChild, nextProps);
475
newChild.ref = workInProgress.ref;
476
newChild.return = workInProgress;
@@ -549,10 +549,7 @@ function updateSimpleMemoComponent(
549
workInProgress,
550
renderLanes,
551
);
552
- } else if (
553
- (current.effectTag & ForceUpdateForLegacySuspense) !==
554
- NoEffect
555
- ) {
552
+ } else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
553
// This is a special case that only exists for legacy mode.
554
// See https://github.com/facebook/react/pull/19216.
555
didReceiveUpdate = true;
@@ -676,7 +673,7 @@ function updateProfiler(
673
renderLanes: Lanes,
674
) {
675
if (enableProfilerTimer) {
679
- workInProgress.effectTag |= Update;
676
+ workInProgress.flags |= Update;
677
678
// Reset effect durations for the next eventual effect phase.
679
// These are reset during render to allow the DevTools commit hook a chance to read them,
@@ -697,7 +694,7 @@ function markRef(current: Fiber | null, workInProgress: Fiber) {
694
(current !== null && current.ref !== ref)
695
) {
696
// Schedule a Ref effect
700
- workInProgress.effectTag |= Ref;
697
+ workInProgress.flags |= Ref;
698
}
699
}
700
@@ -779,7 +776,7 @@ function updateFunctionComponent(
776
}
777
778
// React DevTools reads this flag.
782
- workInProgress.effectTag |= PerformedWork;
779
+ workInProgress.flags |= PerformedWork;
780
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
781
return workInProgress.child;
782
}
@@ -848,7 +845,7 @@ function updateBlock<Props, Data>(
845
}
846
847
// React DevTools reads this flag.
851
- workInProgress.effectTag |= PerformedWork;
848
+ workInProgress.flags |= PerformedWork;
849
reconcileChildren(current, workInProgress, nextChildren, renderLanes);
850
return workInProgress.child;
851
}
@@ -899,7 +896,7 @@ function updateClassComponent(
896
current.alternate = null;
897
workInProgress.alternate = null;
898
// Since this is conceptually a new fiber, schedule a Placement effect
902
- workInProgress.effectTag |= Placement;
899
+ workInProgress.flags |= Placement;
900
}
901
// In the initial pass we might need to construct the instance.
902
constructClassInstance(workInProgress, Component, nextProps);
@@ -957,7 +954,7 @@ function finishClassComponent(
954
// Refs should update even if shouldComponentUpdate returns false
955
markRef(current, workInProgress);
956
960
- const didCaptureError = (workInProgress.effectTag & DidCapture) !== NoEffect;
957
+ const didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags;
958
959
if (!shouldUpdate && !didCaptureError) {
960
// Context providers should defer to sCU for rendering
@@ -1009,7 +1006,7 @@ function finishClassComponent(
1006
}
1007
1008
// React DevTools reads this flag.
1012
- workInProgress.effectTag |= PerformedWork;
1009
+ workInProgress.flags |= PerformedWork;
1010
if (current !== null && didCaptureError) {
1011
// If we're recovering from an error, reconcile without reusing any of
1012
// the existing children. Conceptually, the normal children and the children
@@ -1111,7 +1108,7 @@ function updateHostRoot(current, workInProgress, renderLanes) {
1108
// Conceptually this is similar to Placement in that a new subtree is
1109
// inserted into the React tree here. It just happens to not need DOM
1110
// mutations because it already exists.
1114
- node.effectTag = (node.effectTag & ~Placement) | Hydrating;
1111
+ node.flags = (node.flags & ~Placement) | Hydrating;
1112
node = node.sibling;
1113
}
1114
} else {
@@ -1150,7 +1147,7 @@ function updateHostComponent(
1147
} else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
1148
// If we're switching from a direct text child to a normal child, or to
1149
// empty, we need to schedule the text content to be reset.
1153
- workInProgress.effectTag |= ContentReset;
1150
+ workInProgress.flags |= ContentReset;
1151
}
1152
1153
markRef(current, workInProgress);
@@ -1182,7 +1179,7 @@ function mountLazyComponent(
1179
_current.alternate = null;
1180
workInProgress.alternate = null;
1181
// Since this is conceptually a new fiber, schedule a Placement effect
1185
- workInProgress.effectTag |= Placement;
1182
+ workInProgress.flags |= Placement;
1183
}
1184
1185
const props = workInProgress.pendingProps;
@@ -1318,7 +1315,7 @@ function mountIncompleteClassComponent(
1315
_current.alternate = null;
1316
workInProgress.alternate = null;
1317
// Since this is conceptually a new fiber, schedule a Placement effect
1321
- workInProgress.effectTag |= Placement;
1318
+ workInProgress.flags |= Placement;
1319
}
1320
1321
// Promote the fiber to a class and try rendering again.
@@ -1365,7 +1362,7 @@ function mountIndeterminateComponent(
1362
_current.alternate = null;
1363
workInProgress.alternate = null;
1364
// Since this is conceptually a new fiber, schedule a Placement effect
1368
- workInProgress.effectTag |= Placement;
1365
+ workInProgress.flags |= Placement;
1366
}
1367
1368
const props = workInProgress.pendingProps;
@@ -1426,7 +1423,7 @@ function mountIndeterminateComponent(
1423
);
1424
}
1425
// React DevTools reads this flag.
1429
- workInProgress.effectTag |= PerformedWork;
1426
+ workInProgress.flags |= PerformedWork;
1427
1428
if (__DEV__) {
1429
// Support for module components is deprecated and is removed behind a flag.
@@ -1698,14 +1695,14 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
1695
// This is used by DevTools to force a boundary to suspend.
1696
if (__DEV__) {
1697
if (shouldSuspend(workInProgress)) {
1701
- workInProgress.effectTag |= DidCapture;
1698
+ workInProgress.flags |= DidCapture;
1699
}
1700
}
1701
1702
let suspenseContext: SuspenseContext = suspenseStackCursor.current;
1703
1704
let showFallback = false;
1708
- const didSuspend = (workInProgress.effectTag & DidCapture) !== NoEffect;
1705
+ const didSuspend = (workInProgress.flags & DidCapture) !== NoFlags;
1706
1707
if (
1708
didSuspend ||
@@ -1719,7 +1716,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
1716
// Something in this boundary's subtree already suspended. Switch to
1717
// rendering the fallback children.
1718
showFallback = true;
1722
- workInProgress.effectTag &= ~DidCapture;
1719
+ workInProgress.flags &= ~DidCapture;
1720
} else {
1721
// Attempting the main content
1722
if (
@@ -1844,7 +1841,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) {
1841
workInProgress.child = current.child;
1842
// The dehydrated completion pass expects this flag to be there
1843
// but the normal suspense pass doesn't.
1847
- workInProgress.effectTag |= DidCapture;
1844
+ workInProgress.flags |= DidCapture;
1845
return null;
1846
} else {
1847
// Suspended but we should no longer be in dehydrated mode.
@@ -2064,7 +2061,7 @@ function updateSuspensePrimaryChildren(
2061
if (currentFallbackChildFragment !== null) {
2062
// Delete the fallback child fragment
2063
currentFallbackChildFragment.nextEffect = null;
2067
- currentFallbackChildFragment.effectTag = Deletion;
2064
+ currentFallbackChildFragment.flags = Deletion;
2065
workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment;
2066
}
2067
@@ -2156,7 +2153,7 @@ function updateSuspenseFallbackChildren(
2153
);
2154
// Needs a placement effect because the parent (the Suspense boundary) already
2155
// mounted but this is a new fiber.
2159
- fallbackChildFragment.effectTag |= Placement;
2156
+ fallbackChildFragment.flags |= Placement;
2157
}
2158
2159
fallbackChildFragment.return = workInProgress;
@@ -2185,7 +2182,7 @@ function retrySuspenseComponentWithoutHydrating(
2182
);
2183
// Needs a placement effect because the parent (the Suspense boundary) already
2184
// mounted but this is a new fiber.
2188
- primaryChildFragment.effectTag |= Placement;
2185
+ primaryChildFragment.flags |= Placement;
2186
workInProgress.memoizedState = null;
2187
2188
return primaryChildFragment;
@@ -2213,7 +2210,7 @@ function mountSuspenseFallbackAfterRetryWithoutHydrating(
2210
);
2211
// Needs a placement effect because the parent (the Suspense
2212
// boundary) already mounted but this is a new fiber.
2216
- fallbackChildFragment.effectTag |= Placement;
2213
+ fallbackChildFragment.flags |= Placement;
2214
2215
primaryChildFragment.return = workInProgress;
2216
fallbackChildFragment.return = workInProgress;
@@ -2366,7 +2363,7 @@ function updateDehydratedSuspenseComponent(
2363
// on the client than if we just leave it alone. If the server times out or errors
2364
// these should update this boundary to the permanent Fallback state instead.
2365
// Mark it as having captured (i.e. suspended).
2369
- workInProgress.effectTag |= DidCapture;
2366
+ workInProgress.flags |= DidCapture;
2367
// Leave the child in place. I.e. the dehydrated fragment.
2368
workInProgress.child = current.child;
2369
// Register a callback to retry this boundary once the server has sent the result.
@@ -2395,7 +2392,7 @@ function updateDehydratedSuspenseComponent(
2392
// Conceptually this is similar to Placement in that a new subtree is
2393
// inserted into the React tree here. It just happens to not need DOM
2394
// mutations because it already exists.
2398
- primaryChildFragment.effectTag |= Hydrating;
2395
+ primaryChildFragment.flags |= Hydrating;
2396
return primaryChildFragment;
2397
}
2398
}
@@ -2684,10 +2681,10 @@ function updateSuspenseListComponent(
2681
suspenseContext,
2682
ForceSuspenseFallback,
2683
);
2687
- workInProgress.effectTag |= DidCapture;
2684
+ workInProgress.flags |= DidCapture;
2685
} else {
2686
const didSuspendBefore =
2690
- current !== null && (current.effectTag & DidCapture) !== NoEffect;
2687
+ current !== null && (current.flags & DidCapture) !== NoFlags;
2688
if (didSuspendBefore) {
2689
// If we previously forced a fallback, we need to schedule work
2690
// on any nested boundaries to let them know to try to render
@@ -2930,7 +2927,7 @@ function updateContextConsumer(
2927
}
2928
2929
// React DevTools reads this flag.
2933
- workInProgress.effectTag |= PerformedWork;
2930
+ workInProgress.flags |= PerformedWork;
2931
reconcileChildren(current, workInProgress, newChildren, renderLanes);
2932
return workInProgress.child;
2933
}
@@ -3039,9 +3036,9 @@ function remountFiber(
3036
returnFiber.firstEffect = returnFiber.lastEffect = current;
3037
}
3038
current.nextEffect = null;
3042
- current.effectTag = Deletion;
3039
+ current.flags = Deletion;
3040
3044
- newWorkInProgress.effectTag |= Placement;
3041
+ newWorkInProgress.flags |= Placement;
3042
3043
// Restart work from the new fiber.
3044
return newWorkInProgress;
@@ -3130,7 +3127,7 @@ function beginWork(
3127
workInProgress.childLanes,
3128
);
3129
if (hasChildWork) {
3133
- workInProgress.effectTag |= Update;
3130
+ workInProgress.flags |= Update;
3131
}
3132
3133
// Reset effect durations for the next eventual effect phase.
@@ -3152,7 +3149,7 @@ function beginWork(
3149
// We know that this component will suspend again because if it has
3150
// been unsuspended it has committed as a resolved Suspense component.
3151
// If it needs to be retried, it should have work scheduled on it.
3155
- workInProgress.effectTag |= DidCapture;
3152
+ workInProgress.flags |= DidCapture;
3153
// We should never render the children of a dehydrated boundary until we
3154
// upgrade it. We return null instead of bailoutOnAlreadyFinishedWork.
3155
return null;
@@ -3204,8 +3201,7 @@ function beginWork(
3201
break;
3202
}
3203
case SuspenseListComponent: {
3207
- const didSuspendBefore =
3208
- (current.effectTag & DidCapture) !== NoEffect;
3204
+ const didSuspendBefore = (current.flags & DidCapture) !== NoFlags;
3205
3206
const hasChildWork = includesSomeLane(
3207
renderLanes,
@@ -3228,7 +3224,7 @@ function beginWork(
3224
// If none of the children had any work, that means that none of
3225
// them got retried so they'll still be blocked in the same way
3226
// as before. We can fast bail out.
3231
- workInProgress.effectTag |= DidCapture;
3227
+ workInProgress.flags |= DidCapture;
3228
}
3229
3230
// If nothing suspended before and we're rendering the same children,
@@ -3269,7 +3265,7 @@ function beginWork(
3265
}
3266
return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
3267
} else {
3272
- if ((current.effectTag & ForceUpdateForLegacySuspense) !== NoEffect) {
3268
+ if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
3269
// This is a special case that only exists for legacy mode.
3270
// See https://github.com/facebook/react/pull/19216.
3271
didReceiveUpdate = true;
packages/react-reconciler/src/ReactFiberClassComponent.new.js
+11
-11
@@ -12,7 +12,7 @@ import type {Lanes} from './ReactFiberLane';
12
import type {UpdateQueue} from './ReactUpdateQueue.new';
13
14
import * as React from 'react';
15
-import {Update, Snapshot} from './ReactSideEffectTags';
15
+import {Update, Snapshot} from './ReactFiberFlags';
16
import {
17
debugRenderPhaseSideEffectsForStrictMode,
18
disableLegacyContext,
@@ -890,7 +890,7 @@ function mountClassInstance(
890
}
891
892
if (typeof instance.componentDidMount === 'function') {
893
- workInProgress.effectTag |= Update;
893
+ workInProgress.flags |= Update;
894
}
895
}
896
@@ -960,7 +960,7 @@ function resumeMountClassInstance(
960
// If an update was already in progress, we should schedule an Update
961
// effect even though we're bailing out, so that cWU/cDU are called.
962
if (typeof instance.componentDidMount === 'function') {
963
- workInProgress.effectTag |= Update;
963
+ workInProgress.flags |= Update;
964
}
965
return false;
966
}
@@ -1003,13 +1003,13 @@ function resumeMountClassInstance(
1003
}
1004
}
1005
if (typeof instance.componentDidMount === 'function') {
1006
- workInProgress.effectTag |= Update;
1006
+ workInProgress.flags |= Update;
1007
}
1008
} else {
1009
// If an update was already in progress, we should schedule an Update
1010
// effect even though we're bailing out, so that cWU/cDU are called.
1011
if (typeof instance.componentDidMount === 'function') {
1012
- workInProgress.effectTag |= Update;
1012
+ workInProgress.flags |= Update;
1013
}
1014
1015
// If shouldComponentUpdate returned false, we should still update the
@@ -1106,7 +1106,7 @@ function updateClassInstance(
1106
unresolvedOldProps !== current.memoizedProps ||
1107
oldState !== current.memoizedState
1108
) {
1109
- workInProgress.effectTag |= Update;
1109
+ workInProgress.flags |= Update;
1110
}
1111
}
1112
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
@@ -1114,7 +1114,7 @@ function updateClassInstance(
1114
unresolvedOldProps !== current.memoizedProps ||
1115
oldState !== current.memoizedState
1116
) {
1117
- workInProgress.effectTag |= Snapshot;
1117
+ workInProgress.flags |= Snapshot;
1118
}
1119
}
1120
return false;
@@ -1158,10 +1158,10 @@ function updateClassInstance(
1158
}
1159
}
1160
if (typeof instance.componentDidUpdate === 'function') {
1161
- workInProgress.effectTag |= Update;
1161
+ workInProgress.flags |= Update;
1162
}
1163
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
1164
- workInProgress.effectTag |= Snapshot;
1164
+ workInProgress.flags |= Snapshot;
1165
}
1166
} else {
1167
// If an update was already in progress, we should schedule an Update
@@ -1171,7 +1171,7 @@ function updateClassInstance(
1171
unresolvedOldProps !== current.memoizedProps ||
1172
oldState !== current.memoizedState
1173
) {
1174
- workInProgress.effectTag |= Update;
1174
+ workInProgress.flags |= Update;
1175
}
1176
}
1177
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
@@ -1179,7 +1179,7 @@ function updateClassInstance(
1179
unresolvedOldProps !== current.memoizedProps ||
1180
oldState !== current.memoizedState
1181
) {
1182
- workInProgress.effectTag |= Snapshot;
1182
+ workInProgress.flags |= Snapshot;
1183
}
1184
}
1185
packages/react-reconciler/src/ReactFiberClassComponent.old.js
+11
-11
@@ -12,7 +12,7 @@ import type {Lanes} from './ReactFiberLane';
12
import type {UpdateQueue} from './ReactUpdateQueue.old';
13
14
import * as React from 'react';
15
-import {Update, Snapshot} from './ReactSideEffectTags';
15
+import {Update, Snapshot} from './ReactFiberFlags';
16
import {
17
debugRenderPhaseSideEffectsForStrictMode,
18
disableLegacyContext,
@@ -890,7 +890,7 @@ function mountClassInstance(
890
}
891
892
if (typeof instance.componentDidMount === 'function') {
893
- workInProgress.effectTag |= Update;
893
+ workInProgress.flags |= Update;
894
}
895
}
896
@@ -960,7 +960,7 @@ function resumeMountClassInstance(
960
// If an update was already in progress, we should schedule an Update
961
// effect even though we're bailing out, so that cWU/cDU are called.
962
if (typeof instance.componentDidMount === 'function') {
963
- workInProgress.effectTag |= Update;
963
+ workInProgress.flags |= Update;
964
}
965
return false;
966
}
@@ -1003,13 +1003,13 @@ function resumeMountClassInstance(
1003
}
1004
}
1005
if (typeof instance.componentDidMount === 'function') {
1006
- workInProgress.effectTag |= Update;
1006
+ workInProgress.flags |= Update;
1007
}
1008
} else {
1009
// If an update was already in progress, we should schedule an Update
1010
// effect even though we're bailing out, so that cWU/cDU are called.
1011
if (typeof instance.componentDidMount === 'function') {
1012
- workInProgress.effectTag |= Update;
1012
+ workInProgress.flags |= Update;
1013
}
1014
1015
// If shouldComponentUpdate returned false, we should still update the
@@ -1106,7 +1106,7 @@ function updateClassInstance(
1106
unresolvedOldProps !== current.memoizedProps ||
1107
oldState !== current.memoizedState
1108
) {
1109
- workInProgress.effectTag |= Update;
1109
+ workInProgress.flags |= Update;
1110
}
1111
}
1112
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
@@ -1114,7 +1114,7 @@ function updateClassInstance(
1114
unresolvedOldProps !== current.memoizedProps ||
1115
oldState !== current.memoizedState
1116
) {
1117
- workInProgress.effectTag |= Snapshot;
1117
+ workInProgress.flags |= Snapshot;
1118
}
1119
}
1120
return false;
@@ -1158,10 +1158,10 @@ function updateClassInstance(
1158
}
1159
}
1160
if (typeof instance.componentDidUpdate === 'function') {
1161
- workInProgress.effectTag |= Update;
1161
+ workInProgress.flags |= Update;
1162
}
1163
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
1164
- workInProgress.effectTag |= Snapshot;
1164
+ workInProgress.flags |= Snapshot;
1165
}
1166
} else {
1167
// If an update was already in progress, we should schedule an Update
@@ -1171,7 +1171,7 @@ function updateClassInstance(
1171
unresolvedOldProps !== current.memoizedProps ||
1172
oldState !== current.memoizedState
1173
) {
1174
- workInProgress.effectTag |= Update;
1174
+ workInProgress.flags |= Update;
1175
}
1176
}
1177
if (typeof instance.getSnapshotBeforeUpdate === 'function') {
@@ -1179,7 +1179,7 @@ function updateClassInstance(
1179
unresolvedOldProps !== current.memoizedProps ||
1180
oldState !== current.memoizedState
1181
) {
1182
- workInProgress.effectTag |= Snapshot;
1182
+ workInProgress.flags |= Snapshot;
1183
}
1184
}
1185
packages/react-reconciler/src/ReactFiberCommitWork.new.js
+24
-21
@@ -27,7 +27,7 @@ import type {
27
import type {Wakeable} from 'shared/ReactTypes';
28
import type {ReactPriorityLevel} from './ReactInternalTypes';
29
import type {OffscreenState} from './ReactFiberOffscreenComponent';
30
-import type {HookEffectTag} from './ReactHookEffectTags';
30
+import type {HookFlags} from './ReactHookEffectTags';
31
32
import {unstable_wrap as Schedule_tracing_wrap} from 'scheduler/tracing';
33
import {
@@ -66,12 +66,12 @@ import {
66
clearCaughtError,
67
} from 'shared/ReactErrorUtils';
68
import {
69
- NoEffect,
69
+ NoFlags,
70
ContentReset,
71
Placement,
72
Snapshot,
73
Update,
74
-} from './ReactSideEffectTags';
74
+} from './ReactFiberFlags';
75
import getComponentName from 'shared/getComponentName';
76
import invariant from 'shared/invariant';
77
@@ -124,16 +124,16 @@ import {
124
schedulePassiveEffectCallback,
125
} from './ReactFiberWorkLoop.new';
126
import {
127
- NoEffect as NoHookEffect,
127
+ NoFlags as NoHookEffect,
128
HasEffect as HookHasEffect,
129
Layout as HookLayout,
130
Passive as HookPassive,
131
} from './ReactHookEffectTags';
132
import {didWarnAboutReassigningProps} from './ReactFiberBeginWork.new';
133
import {
134
- NoEffect as NoSubtreeTag,
135
- Passive as PassiveSubtreeTag,
136
-} from './ReactSubtreeTags';
134
+ NoFlags as NoSubtreeFlags,
135
+ Passive as PassiveSubtreeFlags,
136
+} from './ReactSubtreeFlags';
137
138
let didWarnAboutUndefinedSnapshotBeforeUpdate: Set<mixed> | null = null;
139
if (__DEV__) {
@@ -243,7 +243,7 @@ function commitBeforeMutationLifeCycles(
243
return;
244
}
245
case ClassComponent: {
246
- if (finishedWork.effectTag & Snapshot) {
246
+ if (finishedWork.flags & Snapshot) {
247
if (current !== null) {
248
const prevProps = current.memoizedProps;
249
const prevState = current.memoizedState;
@@ -302,7 +302,7 @@ function commitBeforeMutationLifeCycles(
302
}
303
case HostRoot: {
304
if (supportsMutation) {
305
- if (finishedWork.effectTag & Snapshot) {
305
+ if (finishedWork.flags & Snapshot) {
306
const root = finishedWork.stateNode;
307
clearContainer(root.containerInfo);
308
}
@@ -324,7 +324,7 @@ function commitBeforeMutationLifeCycles(
324
}
325
326
function commitHookEffectListUnmount(
327
- tag: HookEffectTag,
327
+ tag: HookFlags,
328
finishedWork: Fiber,
329
nearestMountedAncestor: Fiber | null,
330
) {
@@ -350,7 +350,7 @@ function commitHookEffectListUnmount(
350
// TODO: Remove this duplication.
351
function commitHookEffectListUnmount2(
352
// Tags to check for when deciding whether to unmount. e.g. to skip over layout effects
353
- hookEffectTag: HookEffectTag,
353
+ hookFlags: HookFlags,
354
fiber: Fiber,
355
nearestMountedAncestor: Fiber | null,
356
): void {
@@ -361,7 +361,7 @@ function commitHookEffectListUnmount2(
361
let effect = firstEffect;
362
do {
363
const {next, tag} = effect;
364
- if ((tag & hookEffectTag) === hookEffectTag) {
364
+ if ((tag & hookFlags) === hookFlags) {
365
const destroy = effect.destroy;
366
if (destroy !== undefined) {
367
effect.destroy = undefined;
@@ -383,7 +383,7 @@ function commitHookEffectListUnmount2(
383
}
384
}
385
386
-function commitHookEffectListMount(tag: HookEffectTag, finishedWork: Fiber) {
386
+function commitHookEffectListMount(tag: HookFlags, finishedWork: Fiber) {
387
const updateQueue: FunctionComponentUpdateQueue | null = (finishedWork.updateQueue: any);
388
const lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
389
if (lastEffect !== null) {
@@ -516,7 +516,7 @@ export function commitPassiveEffectDurations(
516
): void {
517
if (enableProfilerTimer && enableProfilerCommitHooks) {
518
// Only Profilers with work in their subtree will have an Update effect scheduled.
519
- if ((finishedWork.effectTag & Update) !== NoEffect) {
519
+ if ((finishedWork.flags & Update) !== NoFlags) {
520
switch (finishedWork.tag) {
521
case Profiler: {
522
const {passiveEffectDuration} = finishedWork.stateNode;
@@ -595,14 +595,17 @@ function commitLifeCycles(
595
commitHookEffectListMount(HookLayout | HookHasEffect, finishedWork);
596
}
597
598
- if ((finishedWork.subtreeTag & PassiveSubtreeTag) !== NoSubtreeTag) {
598
+ if (
599
+ (finishedWork.subtreeFlags & PassiveSubtreeFlags) !==
600
+ NoSubtreeFlags
601
+ ) {
602
schedulePassiveEffectCallback();
603
}
604
return;
605
}
606
case ClassComponent: {
607
const instance = finishedWork.stateNode;
605
- if (finishedWork.effectTag & Update) {
608
+ if (finishedWork.flags & Update) {
609
if (current === null) {
610
// We could update instance props and state here,
611
// but instead we rely on them being set during last render.
@@ -778,7 +781,7 @@ function commitLifeCycles(
781
// (eg DOM renderer may schedule auto-focus for inputs and form controls).
782
// These effects should only be committed when components are first mounted,
783
// aka when there is no current/alternate.
781
- if (current === null && finishedWork.effectTag & Update) {
784
+ if (current === null && finishedWork.flags & Update) {
785
const type = finishedWork.type;
786
const props = finishedWork.memoizedProps;
787
commitMount(instance, type, props, finishedWork);
@@ -1246,7 +1249,7 @@ function getHostSibling(fiber: Fiber): ?Instance {
1249
) {
1250
// If it is not host node and, we might have a host node inside it.
1251
// Try to search down until we find one.
1249
- if (node.effectTag & Placement) {
1252
+ if (node.flags & Placement) {
1253
// If we don't have a child, try the siblings instead.
1254
continue siblings;
1255
}
@@ -1260,7 +1263,7 @@ function getHostSibling(fiber: Fiber): ?Instance {
1263
}
1264
}
1265
// Check if this host node is stable or about to be placed.
1263
- if (!(node.effectTag & Placement)) {
1266
+ if (!(node.flags & Placement)) {
1267
// Found it!
1268
return node.stateNode;
1269
}
@@ -1305,11 +1308,11 @@ function commitPlacement(finishedWork: Fiber): void {
1308
'in React. Please file an issue.',
1309
);
1310
}
1308
- if (parentFiber.effectTag & ContentReset) {
1311
+ if (parentFiber.flags & ContentReset) {
1312
// Reset the text content of the parent before doing any insertions
1313
resetTextContent(parent);
1314
// Clear ContentReset from the effect tag
1312
- parentFiber.effectTag &= ~ContentReset;
1315
+ parentFiber.flags &= ~ContentReset;
1316
}
1317
1318
const before = getHostSibling(finishedWork);
packages/react-reconciler/src/ReactFiberCommitWork.old.js
+12
-12
@@ -62,12 +62,12 @@ import {
62
clearCaughtError,
63
} from 'shared/ReactErrorUtils';
64
import {
65
- NoEffect,
65
+ NoFlags,
66
ContentReset,
67
Placement,
68
Snapshot,
69
Update,
70
-} from './ReactSideEffectTags';
70
+} from './ReactFiberFlags';
71
import getComponentName from 'shared/getComponentName';
72
import invariant from 'shared/invariant';
73
@@ -119,7 +119,7 @@ import {
119
enqueuePendingPassiveProfilerEffect,
120
} from './ReactFiberWorkLoop.old';
121
import {
122
- NoEffect as NoHookEffect,
122
+ NoFlags as NoHookEffect,
123
HasEffect as HookHasEffect,
124
Layout as HookLayout,
125
Passive as HookPassive,
@@ -234,7 +234,7 @@ function commitBeforeMutationLifeCycles(
234
return;
235
}
236
case ClassComponent: {
237
- if (finishedWork.effectTag & Snapshot) {
237
+ if (finishedWork.flags & Snapshot) {
238
if (current !== null) {
239
const prevProps = current.memoizedProps;
240
const prevState = current.memoizedState;
@@ -293,7 +293,7 @@ function commitBeforeMutationLifeCycles(
293
}
294
case HostRoot: {
295
if (supportsMutation) {
296
- if (finishedWork.effectTag & Snapshot) {
296
+ if (finishedWork.flags & Snapshot) {
297
const root = finishedWork.stateNode;
298
clearContainer(root.containerInfo);
299
}
@@ -410,7 +410,7 @@ export function commitPassiveEffectDurations(
410
): void {
411
if (enableProfilerTimer && enableProfilerCommitHooks) {
412
// Only Profilers with work in their subtree will have an Update effect scheduled.
413
- if ((finishedWork.effectTag & Update) !== NoEffect) {
413
+ if ((finishedWork.flags & Update) !== NoFlags) {
414
switch (finishedWork.tag) {
415
case Profiler: {
416
const {passiveEffectDuration} = finishedWork.stateNode;
@@ -494,7 +494,7 @@ function commitLifeCycles(
494
}
495
case ClassComponent: {
496
const instance = finishedWork.stateNode;
497
- if (finishedWork.effectTag & Update) {
497
+ if (finishedWork.flags & Update) {
498
if (current === null) {
499
// We could update instance props and state here,
500
// but instead we rely on them being set during last render.
@@ -670,7 +670,7 @@ function commitLifeCycles(
670
// (eg DOM renderer may schedule auto-focus for inputs and form controls).
671
// These effects should only be committed when components are first mounted,
672
// aka when there is no current/alternate.
673
- if (current === null && finishedWork.effectTag & Update) {
673
+ if (current === null && finishedWork.flags & Update) {
674
const type = finishedWork.type;
675
const props = finishedWork.memoizedProps;
676
commitMount(instance, type, props, finishedWork);
@@ -1148,7 +1148,7 @@ function getHostSibling(fiber: Fiber): ?Instance {
1148
) {
1149
// If it is not host node and, we might have a host node inside it.
1150
// Try to search down until we find one.
1151
- if (node.effectTag & Placement) {
1151
+ if (node.flags & Placement) {
1152
// If we don't have a child, try the siblings instead.
1153
continue siblings;
1154
}
@@ -1162,7 +1162,7 @@ function getHostSibling(fiber: Fiber): ?Instance {
1162
}
1163
}
1164
// Check if this host node is stable or about to be placed.
1165
- if (!(node.effectTag & Placement)) {
1165
+ if (!(node.flags & Placement)) {
1166
// Found it!
1167
return node.stateNode;
1168
}
@@ -1207,11 +1207,11 @@ function commitPlacement(finishedWork: Fiber): void {
1207
'in React. Please file an issue.',
1208
);
1209
}
1210
- if (parentFiber.effectTag & ContentReset) {
1210
+ if (parentFiber.flags & ContentReset) {
1211
// Reset the text content of the parent before doing any insertions
1212
resetTextContent(parent);
1213
// Clear ContentReset from the effect tag
1214
- parentFiber.effectTag &= ~ContentReset;
1214
+ parentFiber.flags &= ~ContentReset;
1215
}
1216
1217
const before = getHostSibling(finishedWork);
packages/react-reconciler/src/ReactFiberCompleteWork.new.js
+26
-27
@@ -62,12 +62,12 @@ import {NoMode, BlockingMode, ProfileMode} from './ReactTypeOfMode';
62
import {
63
Ref,
64
Update,
65
- NoEffect,
65
+ NoFlags,
66
DidCapture,
67
Snapshot,
68
MutationMask,
69
-} from './ReactSideEffectTags';
70
-import {NoEffect as NoSubtreeTag, Mutation} from './ReactSubtreeTags';
69
+} from './ReactFiberFlags';
70
+import {NoFlags as NoSubtreeFlags, Mutation} from './ReactSubtreeFlags';
71
import invariant from 'shared/invariant';
72
73
import {
@@ -148,11 +148,11 @@ import {transferActualDuration} from './ReactProfilerTimer.new';
148
function markUpdate(workInProgress: Fiber) {
149
// Tag the fiber with an update effect. This turns a Placement into
150
// a PlacementAndUpdate.
151
- workInProgress.effectTag |= Update;
151
+ workInProgress.flags |= Update;
152
}
153
154
function markRef(workInProgress: Fiber) {
155
- workInProgress.effectTag |= Ref;
155
+ workInProgress.flags |= Ref;
156
}
157
158
function hadNoMutationsEffects(current: null | Fiber, completedWork: Fiber) {
@@ -163,10 +163,10 @@ function hadNoMutationsEffects(current: null | Fiber, completedWork: Fiber) {
163
164
let child = completedWork.child;
165
while (child !== null) {
166
- if ((child.effectTag & MutationMask) !== NoEffect) {
166
+ if ((child.flags & MutationMask) !== NoFlags) {
167
return false;
168
}
169
- if ((child.subtreeTag & Mutation) !== NoSubtreeTag) {
169
+ if ((child.subtreeFlags & Mutation) !== NoSubtreeFlags) {
170
return false;
171
}
172
child = child.sibling;
@@ -318,7 +318,7 @@ if (supportsMutation) {
318
// down its children. Instead, we'll get insertions from each child in
319
// the portal directly.
320
} else if (node.tag === SuspenseComponent) {
321
- if ((node.effectTag & Update) !== NoEffect) {
321
+ if ((node.flags & Update) !== NoFlags) {
322
// Need to toggle the visibility of the primary children.
323
const newIsHidden = node.memoizedState !== null;
324
if (newIsHidden) {
@@ -412,7 +412,7 @@ if (supportsMutation) {
412
// down its children. Instead, we'll get insertions from each child in
413
// the portal directly.
414
} else if (node.tag === SuspenseComponent) {
415
- if ((node.effectTag & Update) !== NoEffect) {
415
+ if ((node.flags & Update) !== NoFlags) {
416
// Need to toggle the visibility of the primary children.
417
const newIsHidden = node.memoizedState !== null;
418
if (newIsHidden) {
@@ -717,7 +717,7 @@ function completeWork(
717
// This handles the case of React rendering into a container with previous children.
718
// It's also safe to do for updates too, because current.child would only be null
719
// if the previous render was null (so the the container would already be empty).
720
- workInProgress.effectTag |= Snapshot;
720
+ workInProgress.flags |= Snapshot;
721
}
722
}
723
updateHostContainer(current, workInProgress);
@@ -863,7 +863,7 @@ function completeWork(
863
// However, in some of those paths, we might have reentered a hydration state
864
// and then we might be inside a hydration state. In that case, we'll need to exit out of it.
865
resetHydrationState();
866
- if ((workInProgress.effectTag & DidCapture) === NoEffect) {
866
+ if ((workInProgress.flags & DidCapture) === NoFlags) {
867
// This boundary did not suspend so it's now hydrated and unsuspended.
868
workInProgress.memoizedState = null;
869
}
@@ -872,13 +872,13 @@ function completeWork(
872
// It's also a signal to replay events and the suspense callback.
873
// If something suspended, schedule an effect to attach retry listeners.
874
// So we might as well always mark this.
875
- workInProgress.effectTag |= Update;
875
+ workInProgress.flags |= Update;
876
return null;
877
}
878
}
879
}
880
881
- if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
881
+ if ((workInProgress.flags & DidCapture) !== NoFlags) {
882
// Something suspended. Re-render with the fallback children.
883
workInProgress.lanes = renderLanes;
884
// Do not reset the effect list.
@@ -943,7 +943,7 @@ function completeWork(
943
// If this boundary just timed out, schedule an effect to attach a
944
// retry listener to the promise. This flag is also used to hide the
945
// primary children.
946
- workInProgress.effectTag |= Update;
946
+ workInProgress.flags |= Update;
947
}
948
}
949
if (supportsMutation) {
@@ -954,7 +954,7 @@ function completeWork(
954
// primary children. In mutation mode, we also need the flag to
955
// *unhide* children that were previously hidden, so check if this
956
// is currently timed out, too.
957
- workInProgress.effectTag |= Update;
957
+ workInProgress.flags |= Update;
958
}
959
}
960
if (
@@ -963,7 +963,7 @@ function completeWork(
963
workInProgress.memoizedProps.suspenseCallback != null
964
) {
965
// Always notify the callback
966
- workInProgress.effectTag |= Update;
966
+ workInProgress.flags |= Update;
967
}
968
return null;
969
}
@@ -999,8 +999,7 @@ function completeWork(
999
return null;
1000
}
1001
1002
- let didSuspendAlready =
1003
- (workInProgress.effectTag & DidCapture) !== NoEffect;
1002
+ let didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags;
1003
1004
const renderedTail = renderState.rendering;
1005
if (renderedTail === null) {
@@ -1019,14 +1018,14 @@ function completeWork(
1018
// findFirstSuspended.
1019
const cannotBeSuspended =
1020
renderHasNotSuspendedYet() &&
1022
- (current === null || (current.effectTag & DidCapture) === NoEffect);
1021
+ (current === null || (current.flags & DidCapture) === NoFlags);
1022
if (!cannotBeSuspended) {
1023
let row = workInProgress.child;
1024
while (row !== null) {
1025
const suspended = findFirstSuspended(row);
1026
if (suspended !== null) {
1027
didSuspendAlready = true;
1029
- workInProgress.effectTag |= DidCapture;
1028
+ workInProgress.flags |= DidCapture;
1029
cutOffTailIfNeeded(renderState, false);
1030
1031
// If this is a newly suspended tree, it might not get committed as
@@ -1044,13 +1043,13 @@ function completeWork(
1043
const newThennables = suspended.updateQueue;
1044
if (newThennables !== null) {
1045
workInProgress.updateQueue = newThennables;
1047
- workInProgress.effectTag |= Update;
1046
+ workInProgress.flags |= Update;
1047
}
1048
1049
// Rerender the whole list, but this time, we'll force fallbacks
1050
// to stay in place.
1051
// Reset the child fibers to their original state.
1053
- workInProgress.subtreeTag = NoEffect;
1052
+ workInProgress.subtreeFlags = NoFlags;
1053
resetChildFibers(workInProgress, renderLanes);
1054
1055
// Set up the Suspense Context to force suspense and immediately
@@ -1072,7 +1071,7 @@ function completeWork(
1071
// We have already passed our CPU deadline but we still have rows
1072
// left in the tail. We'll just give up further attempts to render
1073
// the main content and only render fallbacks.
1075
- workInProgress.effectTag |= DidCapture;
1074
+ workInProgress.flags |= DidCapture;
1075
didSuspendAlready = true;
1076
1077
cutOffTailIfNeeded(renderState, false);
@@ -1099,7 +1098,7 @@ function completeWork(
1098
if (!didSuspendAlready) {
1099
const suspended = findFirstSuspended(renderedTail);
1100
if (suspended !== null) {
1102
- workInProgress.effectTag |= DidCapture;
1101
+ workInProgress.flags |= DidCapture;
1102
didSuspendAlready = true;
1103
1104
// Ensure we transfer the update queue to the parent so that it doesn't
@@ -1107,7 +1106,7 @@ function completeWork(
1106
const newThennables = suspended.updateQueue;
1107
if (newThennables !== null) {
1108
workInProgress.updateQueue = newThennables;
1110
- workInProgress.effectTag |= Update;
1109
+ workInProgress.flags |= Update;
1110
}
1111
1112
cutOffTailIfNeeded(renderState, true);
@@ -1132,7 +1131,7 @@ function completeWork(
1131
// We have now passed our CPU deadline and we'll just give up further
1132
// attempts to render the main content and only render fallbacks.
1133
// The assumption is that this is usually faster.
1135
- workInProgress.effectTag |= DidCapture;
1134
+ workInProgress.flags |= DidCapture;
1135
didSuspendAlready = true;
1136
1137
cutOffTailIfNeeded(renderState, false);
@@ -1285,7 +1284,7 @@ function completeWork(
1284
prevIsHidden !== nextIsHidden &&
1285
newProps.mode !== 'unstable-defer-without-hiding'
1286
) {
1288
- workInProgress.effectTag |= Update;
1287
+ workInProgress.flags |= Update;
1288
}
1289
}
1290
return null;
packages/react-reconciler/src/ReactFiberCompleteWork.old.js
+21
-28
@@ -59,13 +59,7 @@ import {
59
LegacyHiddenComponent,
60
} from './ReactWorkTags';
61
import {NoMode, BlockingMode, ProfileMode} from './ReactTypeOfMode';
62
-import {
63
- Ref,
64
- Update,
65
- NoEffect,
66
- DidCapture,
67
- Snapshot,
68
-} from './ReactSideEffectTags';
62
+import {Ref, Update, NoFlags, DidCapture, Snapshot} from './ReactFiberFlags';
63
import invariant from 'shared/invariant';
64
65
import {
@@ -146,11 +140,11 @@ import {transferActualDuration} from './ReactProfilerTimer.old';
140
function markUpdate(workInProgress: Fiber) {
141
// Tag the fiber with an update effect. This turns a Placement into
142
// a PlacementAndUpdate.
149
- workInProgress.effectTag |= Update;
143
+ workInProgress.flags |= Update;
144
}
145
146
function markRef(workInProgress: Fiber) {
153
- workInProgress.effectTag |= Ref;
147
+ workInProgress.flags |= Ref;
148
}
149
150
let appendAllChildren;
@@ -297,7 +291,7 @@ if (supportsMutation) {
291
// down its children. Instead, we'll get insertions from each child in
292
// the portal directly.
293
} else if (node.tag === SuspenseComponent) {
300
- if ((node.effectTag & Update) !== NoEffect) {
294
+ if ((node.flags & Update) !== NoFlags) {
295
// Need to toggle the visibility of the primary children.
296
const newIsHidden = node.memoizedState !== null;
297
if (newIsHidden) {
@@ -391,7 +385,7 @@ if (supportsMutation) {
385
// down its children. Instead, we'll get insertions from each child in
386
// the portal directly.
387
} else if (node.tag === SuspenseComponent) {
394
- if ((node.effectTag & Update) !== NoEffect) {
388
+ if ((node.flags & Update) !== NoFlags) {
389
// Need to toggle the visibility of the primary children.
390
const newIsHidden = node.memoizedState !== null;
391
if (newIsHidden) {
@@ -696,7 +690,7 @@ function completeWork(
690
// This handles the case of React rendering into a container with previous children.
691
// It's also safe to do for updates too, because current.child would only be null
692
// if the previous render was null (so the the container would already be empty).
699
- workInProgress.effectTag |= Snapshot;
693
+ workInProgress.flags |= Snapshot;
694
}
695
}
696
updateHostContainer(workInProgress);
@@ -842,7 +836,7 @@ function completeWork(
836
// However, in some of those paths, we might have reentered a hydration state
837
// and then we might be inside a hydration state. In that case, we'll need to exit out of it.
838
resetHydrationState();
845
- if ((workInProgress.effectTag & DidCapture) === NoEffect) {
839
+ if ((workInProgress.flags & DidCapture) === NoFlags) {
840
// This boundary did not suspend so it's now hydrated and unsuspended.
841
workInProgress.memoizedState = null;
842
}
@@ -851,13 +845,13 @@ function completeWork(
845
// It's also a signal to replay events and the suspense callback.
846
// If something suspended, schedule an effect to attach retry listeners.
847
// So we might as well always mark this.
854
- workInProgress.effectTag |= Update;
848
+ workInProgress.flags |= Update;
849
return null;
850
}
851
}
852
}
853
860
- if ((workInProgress.effectTag & DidCapture) !== NoEffect) {
854
+ if ((workInProgress.flags & DidCapture) !== NoFlags) {
855
// Something suspended. Re-render with the fallback children.
856
workInProgress.lanes = renderLanes;
857
// Do not reset the effect list.
@@ -922,7 +916,7 @@ function completeWork(
916
// If this boundary just timed out, schedule an effect to attach a
917
// retry listener to the promise. This flag is also used to hide the
918
// primary children.
925
- workInProgress.effectTag |= Update;
919
+ workInProgress.flags |= Update;
920
}
921
}
922
if (supportsMutation) {
@@ -933,7 +927,7 @@ function completeWork(
927
// primary children. In mutation mode, we also need the flag to
928
// *unhide* children that were previously hidden, so check if this
929
// is currently timed out, too.
936
- workInProgress.effectTag |= Update;
930
+ workInProgress.flags |= Update;
931
}
932
}
933
if (
@@ -942,7 +936,7 @@ function completeWork(
936
workInProgress.memoizedProps.suspenseCallback != null
937
) {
938
// Always notify the callback
945
- workInProgress.effectTag |= Update;
939
+ workInProgress.flags |= Update;
940
}
941
return null;
942
}
@@ -978,8 +972,7 @@ function completeWork(
972
return null;
973
}
974
981
- let didSuspendAlready =
982
- (workInProgress.effectTag & DidCapture) !== NoEffect;
975
+ let didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags;
976
977
const renderedTail = renderState.rendering;
978
if (renderedTail === null) {
@@ -998,14 +991,14 @@ function completeWork(
991
// findFirstSuspended.
992
const cannotBeSuspended =
993
renderHasNotSuspendedYet() &&
1001
- (current === null || (current.effectTag & DidCapture) === NoEffect);
994
+ (current === null || (current.flags & DidCapture) === NoFlags);
995
if (!cannotBeSuspended) {
996
let row = workInProgress.child;
997
while (row !== null) {
998
const suspended = findFirstSuspended(row);
999
if (suspended !== null) {
1000
didSuspendAlready = true;
1008
- workInProgress.effectTag |= DidCapture;
1001
+ workInProgress.flags |= DidCapture;
1002
cutOffTailIfNeeded(renderState, false);
1003
1004
// If this is a newly suspended tree, it might not get committed as
@@ -1023,7 +1016,7 @@ function completeWork(
1016
const newThennables = suspended.updateQueue;
1017
if (newThennables !== null) {
1018
workInProgress.updateQueue = newThennables;
1026
- workInProgress.effectTag |= Update;
1019
+ workInProgress.flags |= Update;
1020
}
1021
1022
// Rerender the whole list, but this time, we'll force fallbacks
@@ -1055,7 +1048,7 @@ function completeWork(
1048
// We have already passed our CPU deadline but we still have rows
1049
// left in the tail. We'll just give up further attempts to render
1050
// the main content and only render fallbacks.
1058
- workInProgress.effectTag |= DidCapture;
1051
+ workInProgress.flags |= DidCapture;
1052
didSuspendAlready = true;
1053
1054
cutOffTailIfNeeded(renderState, false);
@@ -1082,7 +1075,7 @@ function completeWork(
1075
if (!didSuspendAlready) {
1076
const suspended = findFirstSuspended(renderedTail);
1077
if (suspended !== null) {
1085
- workInProgress.effectTag |= DidCapture;
1078
+ workInProgress.flags |= DidCapture;
1079
didSuspendAlready = true;
1080
1081
// Ensure we transfer the update queue to the parent so that it doesn't
@@ -1090,7 +1083,7 @@ function completeWork(
1083
const newThennables = suspended.updateQueue;
1084
if (newThennables !== null) {
1085
workInProgress.updateQueue = newThennables;
1093
- workInProgress.effectTag |= Update;
1086
+ workInProgress.flags |= Update;
1087
}
1088
1089
cutOffTailIfNeeded(renderState, true);
@@ -1124,7 +1117,7 @@ function completeWork(
1117
// We have now passed our CPU deadline and we'll just give up further
1118
// attempts to render the main content and only render fallbacks.
1119
// The assumption is that this is usually faster.
1127
- workInProgress.effectTag |= DidCapture;
1120
+ workInProgress.flags |= DidCapture;
1121
didSuspendAlready = true;
1122
1123
cutOffTailIfNeeded(renderState, false);
@@ -1281,7 +1274,7 @@ function completeWork(
1274
prevIsHidden !== nextIsHidden &&
1275
newProps.mode !== 'unstable-defer-without-hiding'
1276
) {
1284
- workInProgress.effectTag |= Update;
1277
+ workInProgress.flags |= Update;
1278
}
1279
}
1280
return null;
packages/react-reconciler/src/ReactFiberDevToolsHook.new.js
+2
-2
@@ -12,7 +12,7 @@ import {enableProfilerTimer} from 'shared/ReactFeatureFlags';
12
import type {Fiber, FiberRoot, ReactPriorityLevel} from './ReactInternalTypes';
13
import type {ReactNodeList} from 'shared/ReactTypes';
14
15
-import {DidCapture} from './ReactSideEffectTags';
15
+import {DidCapture} from './ReactFiberFlags';
16
17
declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void;
18
@@ -84,7 +84,7 @@ export function onCommitRoot(
84
) {
85
if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') {
86
try {
87
- const didError = (root.current.effectTag & DidCapture) === DidCapture;
87
+ const didError = (root.current.flags & DidCapture) === DidCapture;
88
if (enableProfilerTimer) {
89
injectedHook.onCommitFiberRoot(
90
rendererID,
packages/react-reconciler/src/ReactFiberDevToolsHook.old.js
+2
-2
@@ -12,7 +12,7 @@ import {enableProfilerTimer} from 'shared/ReactFeatureFlags';
12
import type {Fiber, FiberRoot, ReactPriorityLevel} from './ReactInternalTypes';
13
import type {ReactNodeList} from 'shared/ReactTypes';
14
15
-import {DidCapture} from './ReactSideEffectTags';
15
+import {DidCapture} from './ReactFiberFlags';
16
17
declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void;
18
@@ -84,7 +84,7 @@ export function onCommitRoot(
84
) {
85
if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') {
86
try {
87
- const didError = (root.current.effectTag & DidCapture) === DidCapture;
87
+ const didError = (root.current.flags & DidCapture) === DidCapture;
88
if (enableProfilerTimer) {
89
injectedHook.onCommitFiberRoot(
90
rendererID,
packages/react-reconciler/src/ReactFiberFlags.js
renamed
+3
-3
@@ -7,10 +7,10 @@
7
* @flow
8
*/
9
10
-export type SideEffectTag = number;
10
+export type Flags = number;
11
12
// Don't change these two values. They're used by React Dev Tools.
13
-export const NoEffect = /* */ 0b0000000000000000;
13
+export const NoFlags = /* */ 0b0000000000000000;
14
export const PerformedWork = /* */ 0b0000000000000001;
15
16
// You can change the rest (and add more).
@@ -47,7 +47,7 @@ export const ForceUpdateForLegacySuspense = /* */ 0b0100000000000000;
47
// and instead rely on the static flag as a signal that there may be cleanup work.
48
export const PassiveStatic = /* */ 0b1000000000000000;
49
50
-// Union of side effect groupings as pertains to subtreeTag
50
+// Union of side effect groupings as pertains to subtreeFlags
51
export const BeforeMutationMask = /* */ 0b0000001100001010;
52
export const MutationMask = /* */ 0b0000010010011110;
53
export const LayoutMask = /* */ 0b0000000010100100;
packages/react-reconciler/src/ReactFiberHooks.new.js
+12
-12
@@ -15,7 +15,7 @@ import type {
15
} from 'shared/ReactTypes';
16
import type {Fiber, Dispatcher} from './ReactInternalTypes';
17
import type {Lanes, Lane} from './ReactFiberLane';
18
-import type {HookEffectTag} from './ReactHookEffectTags';
18
+import type {HookFlags} from './ReactHookEffectTags';
19
import type {ReactPriorityLevel} from './ReactInternalTypes';
20
import type {FiberRoot} from './ReactInternalTypes';
21
import type {OpaqueIDType} from './ReactFiberHostConfig';
@@ -48,7 +48,7 @@ import {
48
Update as UpdateEffect,
49
Passive as PassiveEffect,
50
PassiveStatic as PassiveStaticEffect,
51
-} from './ReactSideEffectTags';
51
+} from './ReactFiberFlags';
52
import {
53
HasEffect as HookHasEffect,
54
Layout as HookLayout,
@@ -141,7 +141,7 @@ export type Hook = {|
141
|};
142
143
export type Effect = {|
144
- tag: HookEffectTag,
144
+ tag: HookFlags,
145
create: () => (() => void) | void,
146
destroy: (() => void) | void,
147
deps: Array<mixed> | null,
@@ -482,7 +482,7 @@ export function bailoutHooks(
482
lanes: Lanes,
483
) {
484
workInProgress.updateQueue = current.updateQueue;
485
- workInProgress.effectTag &= ~(PassiveEffect | UpdateEffect);
485
+ workInProgress.flags &= ~(PassiveEffect | UpdateEffect);
486
current.lanes = removeLanes(current.lanes, lanes);
487
}
488
@@ -1191,19 +1191,19 @@ function updateRef<T>(initialValue: T): {|current: T|} {
1191
return hook.memoizedState;
1192
}
1193
1194
-function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps): void {
1194
+function mountEffectImpl(fiberFlags, hookFlags, create, deps): void {
1195
const hook = mountWorkInProgressHook();
1196
const nextDeps = deps === undefined ? null : deps;
1197
- currentlyRenderingFiber.effectTag |= fiberEffectTag;
1197
+ currentlyRenderingFiber.flags |= fiberFlags;
1198
hook.memoizedState = pushEffect(
1199
- HookHasEffect | hookEffectTag,
1199
+ HookHasEffect | hookFlags,
1200
create,
1201
undefined,
1202
nextDeps,
1203
);
1204
}
1205
1206
-function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps): void {
1206
+function updateEffectImpl(fiberFlags, hookFlags, create, deps): void {
1207
const hook = updateWorkInProgressHook();
1208
const nextDeps = deps === undefined ? null : deps;
1209
let destroy = undefined;
@@ -1214,16 +1214,16 @@ function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps): void {
1214
if (nextDeps !== null) {
1215
const prevDeps = prevEffect.deps;
1216
if (areHookInputsEqual(nextDeps, prevDeps)) {
1217
- pushEffect(hookEffectTag, create, destroy, nextDeps);
1217
+ pushEffect(hookFlags, create, destroy, nextDeps);
1218
return;
1219
}
1220
}
1221
}
1222
1223
- currentlyRenderingFiber.effectTag |= fiberEffectTag;
1223
+ currentlyRenderingFiber.flags |= fiberFlags;
1224
1225
hook.memoizedState = pushEffect(
1226
- HookHasEffect | hookEffectTag,
1226
+ HookHasEffect | hookFlags,
1227
create,
1228
destroy,
1229
nextDeps,
@@ -1615,7 +1615,7 @@ function mountOpaqueIdentifier(): OpaqueIDType | void {
1615
const setId = mountState(id)[1];
1616
1617
if ((currentlyRenderingFiber.mode & BlockingMode) === NoMode) {
1618
- currentlyRenderingFiber.effectTag |=
1618
+ currentlyRenderingFiber.flags |=
1619
UpdateEffect | PassiveEffect | PassiveStaticEffect;
1620
pushEffect(
1621
HookHasEffect | HookPassive,
packages/react-reconciler/src/ReactFiberHooks.old.js
+12
-12
@@ -15,7 +15,7 @@ import type {
15
} from 'shared/ReactTypes';
16
import type {Fiber, Dispatcher} from './ReactInternalTypes';
17
import type {Lanes, Lane} from './ReactFiberLane';
18
-import type {HookEffectTag} from './ReactHookEffectTags';
18
+import type {HookFlags} from './ReactHookEffectTags';
19
import type {ReactPriorityLevel} from './ReactInternalTypes';
20
import type {FiberRoot} from './ReactInternalTypes';
21
import type {OpaqueIDType} from './ReactFiberHostConfig';
@@ -47,7 +47,7 @@ import {readContext} from './ReactFiberNewContext.old';
47
import {
48
Update as UpdateEffect,
49
Passive as PassiveEffect,
50
-} from './ReactSideEffectTags';
50
+} from './ReactFiberFlags';
51
import {
52
HasEffect as HookHasEffect,
53
Layout as HookLayout,
@@ -140,7 +140,7 @@ export type Hook = {|
140
|};
141
142
export type Effect = {|
143
- tag: HookEffectTag,
143
+ tag: HookFlags,
144
create: () => (() => void) | void,
145
destroy: (() => void) | void,
146
deps: Array<mixed> | null,
@@ -481,7 +481,7 @@ export function bailoutHooks(
481
lanes: Lanes,
482
) {
483
workInProgress.updateQueue = current.updateQueue;
484
- workInProgress.effectTag &= ~(PassiveEffect | UpdateEffect);
484
+ workInProgress.flags &= ~(PassiveEffect | UpdateEffect);
485
current.lanes = removeLanes(current.lanes, lanes);
486
}
487
@@ -1190,19 +1190,19 @@ function updateRef<T>(initialValue: T): {|current: T|} {
1190
return hook.memoizedState;
1191
}
1192
1193
-function mountEffectImpl(fiberEffectTag, hookEffectTag, create, deps): void {
1193
+function mountEffectImpl(fiberFlags, hookFlags, create, deps): void {
1194
const hook = mountWorkInProgressHook();
1195
const nextDeps = deps === undefined ? null : deps;
1196
- currentlyRenderingFiber.effectTag |= fiberEffectTag;
1196
+ currentlyRenderingFiber.flags |= fiberFlags;
1197
hook.memoizedState = pushEffect(
1198
- HookHasEffect | hookEffectTag,
1198
+ HookHasEffect | hookFlags,
1199
create,
1200
undefined,
1201
nextDeps,
1202
);
1203
}
1204
1205
-function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps): void {
1205
+function updateEffectImpl(fiberFlags, hookFlags, create, deps): void {
1206
const hook = updateWorkInProgressHook();
1207
const nextDeps = deps === undefined ? null : deps;
1208
let destroy = undefined;
@@ -1213,16 +1213,16 @@ function updateEffectImpl(fiberEffectTag, hookEffectTag, create, deps): void {
1213
if (nextDeps !== null) {
1214
const prevDeps = prevEffect.deps;
1215
if (areHookInputsEqual(nextDeps, prevDeps)) {
1216
- pushEffect(hookEffectTag, create, destroy, nextDeps);
1216
+ pushEffect(hookFlags, create, destroy, nextDeps);
1217
return;
1218
}
1219
}
1220
}
1221
1222
- currentlyRenderingFiber.effectTag |= fiberEffectTag;
1222
+ currentlyRenderingFiber.flags |= fiberFlags;
1223
1224
hook.memoizedState = pushEffect(
1225
- HookHasEffect | hookEffectTag,
1225
+ HookHasEffect | hookFlags,
1226
create,
1227
destroy,
1228
nextDeps,
@@ -1614,7 +1614,7 @@ function mountOpaqueIdentifier(): OpaqueIDType | void {
1614
const setId = mountState(id)[1];
1615
1616
if ((currentlyRenderingFiber.mode & BlockingMode) === NoMode) {
1617
- currentlyRenderingFiber.effectTag |= UpdateEffect | PassiveEffect;
1617
+ currentlyRenderingFiber.flags |= UpdateEffect | PassiveEffect;
1618
pushEffect(
1619
HookHasEffect | HookPassive,
1620
() => {
packages/react-reconciler/src/ReactFiberHydrationContext.new.js
+3
-3
@@ -24,7 +24,7 @@ import {
24
HostRoot,
25
SuspenseComponent,
26
} from './ReactWorkTags';
27
-import {Deletion, Hydrating, Placement} from './ReactSideEffectTags';
27
+import {Deletion, Hydrating, Placement} from './ReactFiberFlags';
28
import invariant from 'shared/invariant';
29
30
import {
@@ -129,14 +129,14 @@ function deleteHydratableInstance(
129
if (deletions === null) {
130
returnFiber.deletions = [childToDelete];
131
// TODO (effects) Rename this to better reflect its new usage (e.g. ChildDeletions)
132
- returnFiber.effectTag |= Deletion;
132
+ returnFiber.flags |= Deletion;
133
} else {
134
deletions.push(childToDelete);
135
}
136
}
137
138
function insertNonHydratedInstance(returnFiber: Fiber, fiber: Fiber) {
139
- fiber.effectTag = (fiber.effectTag & ~Hydrating) | Placement;
139
+ fiber.flags = (fiber.flags & ~Hydrating) | Placement;
140
if (__DEV__) {
141
switch (returnFiber.tag) {
142
case HostRoot: {
packages/react-reconciler/src/ReactFiberHydrationContext.old.js
+3
-3
@@ -24,7 +24,7 @@ import {
24
HostRoot,
25
SuspenseComponent,
26
} from './ReactWorkTags';
27
-import {Deletion, Placement, Hydrating} from './ReactSideEffectTags';
27
+import {Deletion, Placement, Hydrating} from './ReactFiberFlags';
28
import invariant from 'shared/invariant';
29
30
import {
@@ -124,7 +124,7 @@ function deleteHydratableInstance(
124
const childToDelete = createFiberFromHostInstanceForDeletion();
125
childToDelete.stateNode = instance;
126
childToDelete.return = returnFiber;
127
- childToDelete.effectTag = Deletion;
127
+ childToDelete.flags = Deletion;
128
129
// This might seem like it belongs on progressedFirstDeletion. However,
130
// these children are not part of the reconciliation list of children.
@@ -140,7 +140,7 @@ function deleteHydratableInstance(
140
}
141
142
function insertNonHydratedInstance(returnFiber: Fiber, fiber: Fiber) {
143
- fiber.effectTag = (fiber.effectTag & ~Hydrating) | Placement;
143
+ fiber.flags = (fiber.flags & ~Hydrating) | Placement;
144
if (__DEV__) {
145
switch (returnFiber.tag) {
146
case HostRoot: {
packages/react-reconciler/src/ReactFiberSuspenseComponent.new.js
+2
-2
@@ -11,7 +11,7 @@ import type {Fiber} from './ReactInternalTypes';
11
import type {SuspenseInstance} from './ReactFiberHostConfig';
12
import type {Lane} from './ReactFiberLane';
13
import {SuspenseComponent, SuspenseListComponent} from './ReactWorkTags';
14
-import {NoEffect, DidCapture} from './ReactSideEffectTags';
14
+import {NoFlags, DidCapture} from './ReactFiberFlags';
15
import {
16
isSuspenseInstancePending,
17
isSuspenseInstanceFallback,
@@ -104,7 +104,7 @@ export function findFirstSuspended(row: Fiber): null | Fiber {
104
// keep track of whether it suspended or not.
105
node.memoizedProps.revealOrder !== undefined
106
) {
107
- const didSuspend = (node.effectTag & DidCapture) !== NoEffect;
107
+ const didSuspend = (node.flags & DidCapture) !== NoFlags;
108
if (didSuspend) {
109
return node;
110
}
packages/react-reconciler/src/ReactFiberSuspenseComponent.old.js
+2
-2
@@ -11,7 +11,7 @@ import type {Fiber} from './ReactInternalTypes';
11
import type {SuspenseInstance} from './ReactFiberHostConfig';
12
import type {Lane} from './ReactFiberLane';
13
import {SuspenseComponent, SuspenseListComponent} from './ReactWorkTags';
14
-import {NoEffect, DidCapture} from './ReactSideEffectTags';
14
+import {NoFlags, DidCapture} from './ReactFiberFlags';
15
import {
16
isSuspenseInstancePending,
17
isSuspenseInstanceFallback,
@@ -107,7 +107,7 @@ export function findFirstSuspended(row: Fiber): null | Fiber {
107
// keep track of whether it suspended or not.
108
node.memoizedProps.revealOrder !== undefined
109
) {
110
- const didSuspend = (node.effectTag & DidCapture) !== NoEffect;
110
+ const didSuspend = (node.flags & DidCapture) !== NoFlags;
111
if (didSuspend) {
112
return node;
113
}
packages/react-reconciler/src/ReactFiberThrow.new.js
+10
-10
@@ -25,11 +25,11 @@ import {
25
import {
26
DidCapture,
27
Incomplete,
28
- NoEffect,
28
+ NoFlags,
29
ShouldCapture,
30
LifecycleEffectMask,
31
ForceUpdateForLegacySuspense,
32
-} from './ReactSideEffectTags';
32
+} from './ReactFiberFlags';
33
import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent.new';
34
import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode';
35
import {
@@ -184,7 +184,7 @@ function throwException(
184
rootRenderLanes: Lanes,
185
) {
186
// The source fiber did not complete.
187
- sourceFiber.effectTag |= Incomplete;
187
+ sourceFiber.flags |= Incomplete;
188
189
if (
190
value !== null &&
@@ -255,13 +255,13 @@ function throwException(
255
// inside a blocking mode tree. If the Suspense is outside of it, we
256
// should *not* suspend the commit.
257
if ((workInProgress.mode & BlockingMode) === NoMode) {
258
- workInProgress.effectTag |= DidCapture;
259
- sourceFiber.effectTag |= ForceUpdateForLegacySuspense;
258
+ workInProgress.flags |= DidCapture;
259
+ sourceFiber.flags |= ForceUpdateForLegacySuspense;
260
261
// We're going to commit this fiber even though it didn't complete.
262
// But we shouldn't call any lifecycle methods or callbacks. Remove
263
// all lifecycle effect tags.
264
- sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
264
+ sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
265
266
if (sourceFiber.tag === ClassComponent) {
267
const currentSourceFiber = sourceFiber.alternate;
@@ -332,7 +332,7 @@ function throwException(
332
333
attachPingListener(root, wakeable, rootRenderLanes);
334
335
- workInProgress.effectTag |= ShouldCapture;
335
+ workInProgress.flags |= ShouldCapture;
336
workInProgress.lanes = rootRenderLanes;
337
338
return;
@@ -363,7 +363,7 @@ function throwException(
363
switch (workInProgress.tag) {
364
case HostRoot: {
365
const errorInfo = value;
366
- workInProgress.effectTag |= ShouldCapture;
366
+ workInProgress.flags |= ShouldCapture;
367
const lane = pickArbitraryLane(rootRenderLanes);
368
workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);
369
const update = createRootErrorUpdate(workInProgress, errorInfo, lane);
@@ -376,13 +376,13 @@ function throwException(
376
const ctor = workInProgress.type;
377
const instance = workInProgress.stateNode;
378
if (
379
- (workInProgress.effectTag & DidCapture) === NoEffect &&
379
+ (workInProgress.flags & DidCapture) === NoFlags &&
380
(typeof ctor.getDerivedStateFromError === 'function' ||
381
(instance !== null &&
382
typeof instance.componentDidCatch === 'function' &&
383
!isAlreadyFailedLegacyErrorBoundary(instance)))
384
) {
385
- workInProgress.effectTag |= ShouldCapture;
385
+ workInProgress.flags |= ShouldCapture;
386
const lane = pickArbitraryLane(rootRenderLanes);
387
workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);
388
// Schedule the error boundary to re-render using updated state
packages/react-reconciler/src/ReactFiberThrow.old.js
+10
-10
@@ -25,11 +25,11 @@ import {
25
import {
26
DidCapture,
27
Incomplete,
28
- NoEffect,
28
+ NoFlags,
29
ShouldCapture,
30
LifecycleEffectMask,
31
ForceUpdateForLegacySuspense,
32
-} from './ReactSideEffectTags';
32
+} from './ReactFiberFlags';
33
import {shouldCaptureSuspense} from './ReactFiberSuspenseComponent.old';
34
import {NoMode, BlockingMode, DebugTracingMode} from './ReactTypeOfMode';
35
import {
@@ -184,7 +184,7 @@ function throwException(
184
rootRenderLanes: Lanes,
185
) {
186
// The source fiber did not complete.
187
- sourceFiber.effectTag |= Incomplete;
187
+ sourceFiber.flags |= Incomplete;
188
// Its effect list is no longer valid.
189
sourceFiber.firstEffect = sourceFiber.lastEffect = null;
190
@@ -257,13 +257,13 @@ function throwException(
257
// inside a blocking mode tree. If the Suspense is outside of it, we
258
// should *not* suspend the commit.
259
if ((workInProgress.mode & BlockingMode) === NoMode) {
260
- workInProgress.effectTag |= DidCapture;
261
- sourceFiber.effectTag |= ForceUpdateForLegacySuspense;
260
+ workInProgress.flags |= DidCapture;
261
+ sourceFiber.flags |= ForceUpdateForLegacySuspense;
262
263
// We're going to commit this fiber even though it didn't complete.
264
// But we shouldn't call any lifecycle methods or callbacks. Remove
265
// all lifecycle effect tags.
266
- sourceFiber.effectTag &= ~(LifecycleEffectMask | Incomplete);
266
+ sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
267
268
if (sourceFiber.tag === ClassComponent) {
269
const currentSourceFiber = sourceFiber.alternate;
@@ -334,7 +334,7 @@ function throwException(
334
335
attachPingListener(root, wakeable, rootRenderLanes);
336
337
- workInProgress.effectTag |= ShouldCapture;
337
+ workInProgress.flags |= ShouldCapture;
338
workInProgress.lanes = rootRenderLanes;
339
340
return;
@@ -365,7 +365,7 @@ function throwException(
365
switch (workInProgress.tag) {
366
case HostRoot: {
367
const errorInfo = value;
368
- workInProgress.effectTag |= ShouldCapture;
368
+ workInProgress.flags |= ShouldCapture;
369
const lane = pickArbitraryLane(rootRenderLanes);
370
workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);
371
const update = createRootErrorUpdate(workInProgress, errorInfo, lane);
@@ -378,13 +378,13 @@ function throwException(
378
const ctor = workInProgress.type;
379
const instance = workInProgress.stateNode;
380
if (
381
- (workInProgress.effectTag & DidCapture) === NoEffect &&
381
+ (workInProgress.flags & DidCapture) === NoFlags &&
382
(typeof ctor.getDerivedStateFromError === 'function' ||
383
(instance !== null &&
384
typeof instance.componentDidCatch === 'function' &&
385
!isAlreadyFailedLegacyErrorBoundary(instance)))
386
) {
387
- workInProgress.effectTag |= ShouldCapture;
387
+ workInProgress.flags |= ShouldCapture;
388
const lane = pickArbitraryLane(rootRenderLanes);
389
workInProgress.lanes = mergeLanes(workInProgress.lanes, lane);
390
// Schedule the error boundary to re-render using updated state
packages/react-reconciler/src/ReactFiberTreeReflection.js
+2
-2
@@ -25,7 +25,7 @@ import {
25
FundamentalComponent,
26
SuspenseComponent,
27
} from './ReactWorkTags';
28
-import {NoEffect, Placement, Hydrating} from './ReactSideEffectTags';
28
+import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
29
import {enableFundamentalAPI} from 'shared/ReactFeatureFlags';
30
31
const ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
@@ -39,7 +39,7 @@ export function getNearestMountedFiber(fiber: Fiber): null | Fiber {
39
let nextNode = node;
40
do {
41
node = nextNode;
42
- if ((node.effectTag & (Placement | Hydrating)) !== NoEffect) {
42
+ if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
43
// This is an insertion or in-progress hydration. The nearest possible
44
// mounted fiber is the parent but we need to continue to figure out
45
// if that one is still mounted.
packages/react-reconciler/src/ReactFiberUnwindWork.new.js
+10
-10
@@ -23,7 +23,7 @@ import {
23
OffscreenComponent,
24
LegacyHiddenComponent,
25
} from './ReactWorkTags';
26
-import {DidCapture, NoEffect, ShouldCapture} from './ReactSideEffectTags';
26
+import {DidCapture, NoFlags, ShouldCapture} from './ReactFiberFlags';
27
import {NoMode, ProfileMode} from './ReactTypeOfMode';
28
import {
29
enableSuspenseServerRenderer,
@@ -51,9 +51,9 @@ function unwindWork(workInProgress: Fiber, renderLanes: Lanes) {
51
if (isLegacyContextProvider(Component)) {
52
popLegacyContext(workInProgress);
53
}
54
- const effectTag = workInProgress.effectTag;
55
- if (effectTag & ShouldCapture) {
56
- workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture;
54
+ const flags = workInProgress.flags;
55
+ if (flags & ShouldCapture) {
56
+ workInProgress.flags = (flags & ~ShouldCapture) | DidCapture;
57
if (
58
enableProfilerTimer &&
59
(workInProgress.mode & ProfileMode) !== NoMode
@@ -68,13 +68,13 @@ function unwindWork(workInProgress: Fiber, renderLanes: Lanes) {
68
popHostContainer(workInProgress);
69
popTopLevelLegacyContextObject(workInProgress);
70
resetMutableSourceWorkInProgressVersions();
71
- const effectTag = workInProgress.effectTag;
71
+ const flags = workInProgress.flags;
72
invariant(
73
- (effectTag & DidCapture) === NoEffect,
73
+ (flags & DidCapture) === NoFlags,
74
'The root failed to unmount after an error. This is likely a bug in ' +
75
'React. Please file an issue.',
76
);
77
- workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture;
77
+ workInProgress.flags = (flags & ~ShouldCapture) | DidCapture;
78
return workInProgress;
79
}
80
case HostComponent: {
@@ -96,9 +96,9 @@ function unwindWork(workInProgress: Fiber, renderLanes: Lanes) {
96
resetHydrationState();
97
}
98
}
99
- const effectTag = workInProgress.effectTag;
100
- if (effectTag & ShouldCapture) {
101
- workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture;
99
+ const flags = workInProgress.flags;
100
+ if (flags & ShouldCapture) {
101
+ workInProgress.flags = (flags & ~ShouldCapture) | DidCapture;
102
// Captured a suspense effect. Re-render the boundary.
103
if (
104
enableProfilerTimer &&
packages/react-reconciler/src/ReactFiberUnwindWork.old.js
+10
-10
@@ -23,7 +23,7 @@ import {
23
OffscreenComponent,
24
LegacyHiddenComponent,
25
} from './ReactWorkTags';
26
-import {DidCapture, NoEffect, ShouldCapture} from './ReactSideEffectTags';
26
+import {DidCapture, NoFlags, ShouldCapture} from './ReactFiberFlags';
27
import {NoMode, ProfileMode} from './ReactTypeOfMode';
28
import {
29
enableSuspenseServerRenderer,
@@ -51,9 +51,9 @@ function unwindWork(workInProgress: Fiber, renderLanes: Lanes) {
51
if (isLegacyContextProvider(Component)) {
52
popLegacyContext(workInProgress);
53
}
54
- const effectTag = workInProgress.effectTag;
55
- if (effectTag & ShouldCapture) {
56
- workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture;
54
+ const flags = workInProgress.flags;
55
+ if (flags & ShouldCapture) {
56
+ workInProgress.flags = (flags & ~ShouldCapture) | DidCapture;
57
if (
58
enableProfilerTimer &&
59
(workInProgress.mode & ProfileMode) !== NoMode
@@ -68,13 +68,13 @@ function unwindWork(workInProgress: Fiber, renderLanes: Lanes) {
68
popHostContainer(workInProgress);
69
popTopLevelLegacyContextObject(workInProgress);
70
resetMutableSourceWorkInProgressVersions();
71
- const effectTag = workInProgress.effectTag;
71
+ const flags = workInProgress.flags;
72
invariant(
73
- (effectTag & DidCapture) === NoEffect,
73
+ (flags & DidCapture) === NoFlags,
74
'The root failed to unmount after an error. This is likely a bug in ' +
75
'React. Please file an issue.',
76
);
77
- workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture;
77
+ workInProgress.flags = (flags & ~ShouldCapture) | DidCapture;
78
return workInProgress;
79
}
80
case HostComponent: {
@@ -96,9 +96,9 @@ function unwindWork(workInProgress: Fiber, renderLanes: Lanes) {
96
resetHydrationState();
97
}
98
}
99
- const effectTag = workInProgress.effectTag;
100
- if (effectTag & ShouldCapture) {
101
- workInProgress.effectTag = (effectTag & ~ShouldCapture) | DidCapture;
99
+ const flags = workInProgress.flags;
100
+ if (flags & ShouldCapture) {
101
+ workInProgress.flags = (flags & ~ShouldCapture) | DidCapture;
102
// Captured a suspense effect. Re-render the boundary.
103
if (
104
enableProfilerTimer &&
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+102
-98
@@ -51,7 +51,7 @@ import {
51
scheduleSyncCallback,
52
} from './SchedulerWithReactIntegration.new';
53
import {
54
- NoEffect as NoHookEffect,
54
+ NoFlags as NoHookEffect,
55
Passive as HookPassive,
56
} from './ReactHookEffectTags';
57
import {
@@ -121,7 +121,7 @@ import {
121
} from './ReactWorkTags';
122
import {LegacyRoot} from './ReactRootTags';
123
import {
124
- NoEffect,
124
+ NoFlags,
125
Placement,
126
Update,
127
PlacementAndUpdate,
@@ -139,15 +139,15 @@ import {
139
MutationMask,
140
LayoutMask,
141
PassiveMask,
142
-} from './ReactSideEffectTags';
142
+} from './ReactFiberFlags';
143
import {
144
- NoEffect as NoSubtreeTag,
145
- BeforeMutation as BeforeMutationSubtreeTag,
146
- Mutation as MutationSubtreeTag,
147
- Layout as LayoutSubtreeTag,
148
- Passive as PassiveSubtreeTag,
149
- PassiveStatic as PassiveStaticSubtreeTag,
150
-} from './ReactSubtreeTags';
144
+ NoFlags as NoSubtreeFlags,
145
+ BeforeMutation as BeforeMutationSubtreeFlags,
146
+ Mutation as MutationSubtreeFlags,
147
+ Layout as LayoutSubtreeFlags,
148
+ Passive as PassiveSubtreeFlags,
149
+ PassiveStatic as PassiveStaticSubtreeFlags,
150
+} from './ReactSubtreeFlags';
151
import {
152
NoLanePriority,
153
SyncLanePriority,
@@ -649,7 +649,7 @@ function markUpdateLaneFromFiberToRoot(
649
if (__DEV__) {
650
if (
651
alternate === null &&
652
- (sourceFiber.effectTag & (Placement | Hydrating)) !== NoEffect
652
+ (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags
653
) {
654
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
655
}
@@ -664,7 +664,7 @@ function markUpdateLaneFromFiberToRoot(
664
alternate.childLanes = mergeLanes(alternate.childLanes, lane);
665
} else {
666
if (__DEV__) {
667
- if ((parent.effectTag & (Placement | Hydrating)) !== NoEffect) {
667
+ if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
668
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
669
}
670
}
@@ -1705,7 +1705,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1705
const returnFiber = completedWork.return;
1706
1707
// Check if the work completed or if something threw.
1708
- if ((completedWork.effectTag & Incomplete) === NoEffect) {
1708
+ if ((completedWork.flags & Incomplete) === NoFlags) {
1709
setCurrentDebugFiberInDEV(completedWork);
1710
let next;
1711
if (
@@ -1741,7 +1741,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1741
// back here again.
1742
// Since we're restarting, remove anything that is not a host effect
1743
// from the effect tag.
1744
- next.effectTag &= HostEffectMask;
1744
+ next.flags &= HostEffectMask;
1745
workInProgress = next;
1746
return;
1747
}
@@ -1765,8 +1765,8 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1765
1766
if (returnFiber !== null) {
1767
// Mark the parent fiber as incomplete
1768
- returnFiber.effectTag |= Incomplete;
1769
- returnFiber.subtreeTag = NoSubtreeTag;
1768
+ returnFiber.flags |= Incomplete;
1769
+ returnFiber.subtreeFlags = NoSubtreeFlags;
1770
returnFiber.deletions = null;
1771
}
1772
}
@@ -1809,7 +1809,7 @@ function resetChildLanes(completedWork: Fiber) {
1809
completedWork.alternate.child === completedWork.child;
1810
1811
let newChildLanes = NoLanes;
1812
- let subtreeTag = NoSubtreeTag;
1812
+ let subtreeFlags = NoSubtreeFlags;
1813
1814
if (!didBailout) {
1815
// Bubble up the earliest expiration time.
@@ -1826,23 +1826,23 @@ function resetChildLanes(completedWork: Fiber) {
1826
mergeLanes(child.lanes, child.childLanes),
1827
);
1828
1829
- subtreeTag |= child.subtreeTag;
1829
+ subtreeFlags |= child.subtreeFlags;
1830
1831
- const effectTag = child.effectTag;
1832
- if ((effectTag & BeforeMutationMask) !== NoEffect) {
1833
- subtreeTag |= BeforeMutationSubtreeTag;
1831
+ const flags = child.flags;
1832
+ if ((flags & BeforeMutationMask) !== NoFlags) {
1833
+ subtreeFlags |= BeforeMutationSubtreeFlags;
1834
}
1835
- if ((effectTag & MutationMask) !== NoEffect) {
1836
- subtreeTag |= MutationSubtreeTag;
1835
+ if ((flags & MutationMask) !== NoFlags) {
1836
+ subtreeFlags |= MutationSubtreeFlags;
1837
}
1838
- if ((effectTag & LayoutMask) !== NoEffect) {
1839
- subtreeTag |= LayoutSubtreeTag;
1838
+ if ((flags & LayoutMask) !== NoFlags) {
1839
+ subtreeFlags |= LayoutSubtreeFlags;
1840
}
1841
- if ((effectTag & PassiveMask) !== NoEffect) {
1842
- subtreeTag |= PassiveSubtreeTag;
1841
+ if ((flags & PassiveMask) !== NoFlags) {
1842
+ subtreeFlags |= PassiveSubtreeFlags;
1843
}
1844
- if ((effectTag & PassiveStatic) !== NoEffect) {
1845
- subtreeTag |= PassiveStaticSubtreeTag;
1844
+ if ((flags & PassiveStatic) !== NoFlags) {
1845
+ subtreeFlags |= PassiveStaticSubtreeFlags;
1846
}
1847
1848
// When a fiber is cloned, its actualDuration is reset to 0. This value will
@@ -1879,30 +1879,30 @@ function resetChildLanes(completedWork: Fiber) {
1879
mergeLanes(child.lanes, child.childLanes),
1880
);
1881
1882
- subtreeTag |= child.subtreeTag;
1882
+ subtreeFlags |= child.subtreeFlags;
1883
1884
- const effectTag = child.effectTag;
1885
- if ((effectTag & BeforeMutationMask) !== NoEffect) {
1886
- subtreeTag |= BeforeMutationSubtreeTag;
1884
+ const flags = child.flags;
1885
+ if ((flags & BeforeMutationMask) !== NoFlags) {
1886
+ subtreeFlags |= BeforeMutationSubtreeFlags;
1887
}
1888
- if ((effectTag & MutationMask) !== NoEffect) {
1889
- subtreeTag |= MutationSubtreeTag;
1888
+ if ((flags & MutationMask) !== NoFlags) {
1889
+ subtreeFlags |= MutationSubtreeFlags;
1890
}
1891
- if ((effectTag & LayoutMask) !== NoEffect) {
1892
- subtreeTag |= LayoutSubtreeTag;
1891
+ if ((flags & LayoutMask) !== NoFlags) {
1892
+ subtreeFlags |= LayoutSubtreeFlags;
1893
}
1894
- if ((effectTag & PassiveMask) !== NoEffect) {
1895
- subtreeTag |= PassiveSubtreeTag;
1894
+ if ((flags & PassiveMask) !== NoFlags) {
1895
+ subtreeFlags |= PassiveSubtreeFlags;
1896
}
1897
- if ((effectTag & PassiveStatic) !== NoEffect) {
1898
- subtreeTag |= PassiveStaticSubtreeTag;
1897
+ if ((flags & PassiveStatic) !== NoFlags) {
1898
+ subtreeFlags |= PassiveStaticSubtreeFlags;
1899
}
1900
1901
child = child.sibling;
1902
}
1903
}
1904
1905
- completedWork.subtreeTag |= subtreeTag;
1905
+ completedWork.subtreeFlags |= subtreeFlags;
1906
} else {
1907
// Bubble up the earliest expiration time.
1908
if (enableProfilerTimer && (completedWork.mode & ProfileMode) !== NoMode) {
@@ -1919,10 +1919,10 @@ function resetChildLanes(completedWork: Fiber) {
1919
1920
// Preserve passive static flag even in the case of a bailout;
1921
// otherwise a subsequent unmount may bailout before calling destroy functions.
1922
- subtreeTag |= child.subtreeTag & PassiveStaticSubtreeTag;
1923
- const effectTag = child.effectTag;
1924
- if ((effectTag & PassiveStatic) !== NoEffect) {
1925
- subtreeTag |= PassiveStaticSubtreeTag;
1922
+ subtreeFlags |= child.subtreeFlags & PassiveStaticSubtreeFlags;
1923
+ const flags = child.flags;
1924
+ if ((flags & PassiveStatic) !== NoFlags) {
1925
+ subtreeFlags |= PassiveStaticSubtreeFlags;
1926
}
1927
1928
treeBaseDuration += child.treeBaseDuration;
@@ -1951,17 +1951,17 @@ function resetChildLanes(completedWork: Fiber) {
1951
1952
// Preserve passive static flag even in the case of a bailout;
1953
// otherwise a subsequent unmount may bailout before calling destroy functions.
1954
- subtreeTag |= child.subtreeTag & PassiveStaticSubtreeTag;
1955
- const effectTag = child.effectTag;
1956
- if ((effectTag & PassiveStatic) !== NoEffect) {
1957
- subtreeTag |= PassiveStaticSubtreeTag;
1954
+ subtreeFlags |= child.subtreeFlags & PassiveStaticSubtreeFlags;
1955
+ const flags = child.flags;
1956
+ if ((flags & PassiveStatic) !== NoFlags) {
1957
+ subtreeFlags |= PassiveStaticSubtreeFlags;
1958
}
1959
1960
child = child.sibling;
1961
}
1962
}
1963
1964
- completedWork.subtreeTag |= subtreeTag;
1964
+ completedWork.subtreeFlags |= subtreeFlags;
1965
}
1966
1967
completedWork.childLanes = newChildLanes;
@@ -2066,16 +2066,16 @@ function commitRootImpl(root, renderPriorityLevel) {
2066
// only other reason this optimization exists is because it affects profiling.
2067
// Reconsider whether this is necessary.
2068
const subtreeHasEffects =
2069
- (finishedWork.subtreeTag &
2070
- (BeforeMutationSubtreeTag |
2071
- MutationSubtreeTag |
2072
- LayoutSubtreeTag |
2073
- PassiveSubtreeTag)) !==
2074
- NoSubtreeTag;
2069
+ (finishedWork.subtreeFlags &
2070
+ (BeforeMutationSubtreeFlags |
2071
+ MutationSubtreeFlags |
2072
+ LayoutSubtreeFlags |
2073
+ PassiveSubtreeFlags)) !==
2074
+ NoSubtreeFlags;
2075
const rootHasEffect =
2076
- (finishedWork.effectTag &
2076
+ (finishedWork.flags &
2077
(BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !==
2078
- NoEffect;
2078
+ NoFlags;
2079
2080
if (subtreeHasEffects || rootHasEffect) {
2081
let previousLanePriority;
@@ -2152,8 +2152,8 @@ function commitRootImpl(root, renderPriorityLevel) {
2152
2153
// If there are pending passive effects, schedule a callback to process them.
2154
if (
2155
- (finishedWork.subtreeTag & PassiveSubtreeTag) !== NoSubtreeTag ||
2156
- (finishedWork.effectTag & PassiveMask) !== NoEffect
2155
+ (finishedWork.subtreeFlags & PassiveSubtreeFlags) !== NoSubtreeFlags ||
2156
+ (finishedWork.flags & PassiveMask) !== NoFlags
2157
) {
2158
if (!rootDoesHavePassiveEffects) {
2159
rootDoesHavePassiveEffects = true;
@@ -2306,8 +2306,9 @@ function commitBeforeMutationEffects(firstChild: Fiber) {
2306
}
2307
2308
if (fiber.child !== null) {
2309
- const primarySubtreeTag = fiber.subtreeTag & BeforeMutationSubtreeTag;
2310
- if (primarySubtreeTag !== NoSubtreeTag) {
2309
+ const primarySubtreeFlags =
2310
+ fiber.subtreeFlags & BeforeMutationSubtreeFlags;
2311
+ if (primarySubtreeFlags !== NoSubtreeFlags) {
2312
commitBeforeMutationEffects(fiber.child);
2313
}
2314
}
@@ -2333,7 +2334,7 @@ function commitBeforeMutationEffects(firstChild: Fiber) {
2334
2335
function commitBeforeMutationEffectsImpl(fiber: Fiber) {
2336
const current = fiber.alternate;
2336
- const effectTag = fiber.effectTag;
2337
+ const flags = fiber.flags;
2338
2339
if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) {
2340
// Check to see if the focused element was inside of a hidden (Suspense) subtree.
@@ -2348,13 +2349,13 @@ function commitBeforeMutationEffectsImpl(fiber: Fiber) {
2349
}
2350
}
2351
2351
- if ((effectTag & Snapshot) !== NoEffect) {
2352
+ if ((flags & Snapshot) !== NoFlags) {
2353
setCurrentDebugFiberInDEV(fiber);
2354
commitBeforeMutationEffectOnFiber(current, fiber);
2355
resetCurrentDebugFiberInDEV();
2356
}
2357
2357
- if ((effectTag & Passive) !== NoEffect) {
2358
+ if ((flags & Passive) !== NoFlags) {
2359
// If there are passive effects, schedule a callback to flush at
2360
// the earliest opportunity.
2361
if (!rootDoesHavePassiveEffects) {
@@ -2372,7 +2373,7 @@ function commitBeforeMutationEffectsDeletions(deletions: Array<Fiber>) {
2373
const fiber = deletions[i];
2374
2375
// TODO (effects) It would be nice to avoid calling doesFiberContain()
2375
- // Maybe we can repurpose one of the subtreeTag positions for this instead?
2376
+ // Maybe we can repurpose one of the subtreeFlags positions for this instead?
2377
// Use it to store which part of the tree the focused instance is in?
2378
// This assumes we can safely determine that instance during the "render" phase.
2379
@@ -2401,8 +2402,8 @@ function commitMutationEffects(
2402
}
2403
2404
if (fiber.child !== null) {
2404
- const primarySubtreeTag = fiber.subtreeTag & MutationSubtreeTag;
2405
- if (primarySubtreeTag !== NoSubtreeTag) {
2405
+ const primarySubtreeFlags = fiber.subtreeFlags & MutationSubtreeFlags;
2406
+ if (primarySubtreeFlags !== NoSubtreeFlags) {
2407
commitMutationEffects(fiber.child, root, renderPriorityLevel);
2408
}
2409
}
@@ -2438,12 +2439,12 @@ function commitMutationEffectsImpl(
2439
root: FiberRoot,
2440
renderPriorityLevel,
2441
) {
2441
- const effectTag = fiber.effectTag;
2442
- if (effectTag & ContentReset) {
2442
+ const flags = fiber.flags;
2443
+ if (flags & ContentReset) {
2444
commitResetTextContent(fiber);
2445
}
2446
2446
- if (effectTag & Ref) {
2447
+ if (flags & Ref) {
2448
const current = fiber.alternate;
2449
if (current !== null) {
2450
commitDetachRef(current);
@@ -2461,15 +2462,15 @@ function commitMutationEffectsImpl(
2462
// updates, and deletions. To avoid needing to add a case for every possible
2463
// bitmap value, we remove the secondary effects from the effect tag and
2464
// switch on that value.
2464
- const primaryEffectTag = effectTag & (Placement | Update | Hydrating);
2465
- switch (primaryEffectTag) {
2465
+ const primaryFlags = flags & (Placement | Update | Hydrating);
2466
+ switch (primaryFlags) {
2467
case Placement: {
2468
commitPlacement(fiber);
2469
// Clear the "placement" from effect tag so that we know that this is
2470
// inserted, before any life-cycles like componentDidMount gets called.
2471
// TODO: findDOMNode doesn't rely on this any more but isMounted does
2472
// and isMounted is deprecated anyway so we should be able to kill this.
2472
- fiber.effectTag &= ~Placement;
2473
+ fiber.flags &= ~Placement;
2474
break;
2475
}
2476
case PlacementAndUpdate: {
@@ -2477,7 +2478,7 @@ function commitMutationEffectsImpl(
2478
commitPlacement(fiber);
2479
// Clear the "placement" from effect tag so that we know that this is
2480
// inserted, before any life-cycles like componentDidMount gets called.
2480
- fiber.effectTag &= ~Placement;
2481
+ fiber.flags &= ~Placement;
2482
2483
// Update
2484
const current = fiber.alternate;
@@ -2485,11 +2486,11 @@ function commitMutationEffectsImpl(
2486
break;
2487
}
2488
case Hydrating: {
2488
- fiber.effectTag &= ~Hydrating;
2489
+ fiber.flags &= ~Hydrating;
2490
break;
2491
}
2492
case HydratingAndUpdate: {
2492
- fiber.effectTag &= ~Hydrating;
2493
+ fiber.flags &= ~Hydrating;
2494
2495
// Update
2496
const current = fiber.alternate;
@@ -2559,8 +2560,8 @@ function commitLayoutEffects(
2560
let fiber = firstChild;
2561
while (fiber !== null) {
2562
if (fiber.child !== null) {
2562
- const primarySubtreeTag = fiber.subtreeTag & LayoutSubtreeTag;
2563
- if (primarySubtreeTag !== NoSubtreeTag) {
2563
+ const primarySubtreeFlags = fiber.subtreeFlags & LayoutSubtreeFlags;
2564
+ if (primarySubtreeFlags !== NoSubtreeFlags) {
2565
commitLayoutEffects(fiber.child, root, committedLanes);
2566
}
2567
}
@@ -2596,11 +2597,11 @@ function commitLayoutEffectsImpl(
2597
root: FiberRoot,
2598
committedLanes: Lanes,
2599
) {
2599
- const effectTag = fiber.effectTag;
2600
+ const flags = fiber.flags;
2601
2602
setCurrentDebugFiberInDEV(fiber);
2603
2603
- if (effectTag & (Update | Callback)) {
2604
+ if (flags & (Update | Callback)) {
2605
const current = fiber.alternate;
2606
commitLayoutEffectOnFiber(root, current, fiber, committedLanes);
2607
}
@@ -2608,11 +2609,11 @@ function commitLayoutEffectsImpl(
2609
if (enableScopeAPI) {
2610
// TODO: This is a temporary solution that allowed us to transition away
2611
// from React Flare on www.
2611
- if (effectTag & Ref && fiber.tag !== ScopeComponent) {
2612
+ if (flags & Ref && fiber.tag !== ScopeComponent) {
2613
commitAttachRef(fiber);
2614
}
2615
} else {
2615
- if (effectTag & Ref) {
2616
+ if (flags & Ref) {
2617
commitAttachRef(fiber);
2618
}
2619
}
@@ -2661,13 +2662,13 @@ export function enqueuePendingPassiveProfilerEffect(fiber: Fiber): void {
2662
function flushPassiveMountEffects(firstChild: Fiber): void {
2663
let fiber = firstChild;
2664
while (fiber !== null) {
2664
- const primarySubtreeTag = fiber.subtreeTag & PassiveSubtreeTag;
2665
+ const primarySubtreeFlags = fiber.subtreeFlags & PassiveSubtreeFlags;
2666
2666
- if (fiber.child !== null && primarySubtreeTag !== NoSubtreeTag) {
2667
+ if (fiber.child !== null && primarySubtreeFlags !== NoSubtreeFlags) {
2668
flushPassiveMountEffects(fiber.child);
2669
}
2670
2670
- if ((fiber.effectTag & Update) !== NoEffect) {
2671
+ if ((fiber.flags & Update) !== NoFlags) {
2672
setCurrentDebugFiberInDEV(fiber);
2673
commitPassiveEffectOnFiber(fiber);
2674
resetCurrentDebugFiberInDEV();
@@ -2694,17 +2695,17 @@ function flushPassiveUnmountEffects(firstChild: Fiber): void {
2695
const child = fiber.child;
2696
if (child !== null) {
2697
// If any children have passive effects then traverse the subtree.
2697
- // Note that this requires checking subtreeTag of the current Fiber,
2698
- // rather than the subtreeTag/effectsTag of the first child,
2698
+ // Note that this requires checking subtreeFlags of the current Fiber,
2699
+ // rather than the subtreeFlags/effectsTag of the first child,
2700
// since that would not cover passive effects in siblings.
2700
- const primarySubtreeTag = fiber.subtreeTag & PassiveSubtreeTag;
2701
- if (primarySubtreeTag !== NoSubtreeTag) {
2701
+ const primarySubtreeFlags = fiber.subtreeFlags & PassiveSubtreeFlags;
2702
+ if (primarySubtreeFlags !== NoSubtreeFlags) {
2703
flushPassiveUnmountEffects(child);
2704
}
2705
}
2706
2706
- const primaryEffectTag = fiber.effectTag & Passive;
2707
- if (primaryEffectTag !== NoEffect) {
2707
+ const primaryFlags = fiber.flags & Passive;
2708
+ if (primaryFlags !== NoFlags) {
2709
setCurrentDebugFiberInDEV(fiber);
2710
commitPassiveWork(fiber);
2711
resetCurrentDebugFiberInDEV();
@@ -2718,10 +2719,13 @@ function flushPassiveUnmountEffectsInsideOfDeletedTree(
2719
fiberToDelete: Fiber,
2720
nearestMountedAncestor: Fiber,
2721
): void {
2721
- if ((fiberToDelete.subtreeTag & PassiveStaticSubtreeTag) !== NoSubtreeTag) {
2722
+ if (
2723
+ (fiberToDelete.subtreeFlags & PassiveStaticSubtreeFlags) !==
2724
+ NoSubtreeFlags
2725
+ ) {
2726
// If any children have passive effects then traverse the subtree.
2723
- // Note that this requires checking subtreeTag of the current Fiber,
2724
- // rather than the subtreeTag/effectsTag of the first child,
2727
+ // Note that this requires checking subtreeFlags of the current Fiber,
2728
+ // rather than the subtreeFlags/effectsTag of the first child,
2729
// since that would not cover passive effects in siblings.
2730
let child = fiberToDelete.child;
2731
while (child !== null) {
@@ -2733,7 +2737,7 @@ function flushPassiveUnmountEffectsInsideOfDeletedTree(
2737
}
2738
}
2739
2736
- if ((fiberToDelete.effectTag & PassiveStatic) !== NoEffect) {
2740
+ if ((fiberToDelete.flags & PassiveStatic) !== NoFlags) {
2741
setCurrentDebugFiberInDEV(fiberToDelete);
2742
commitPassiveUnmount(fiberToDelete, nearestMountedAncestor);
2743
resetCurrentDebugFiberInDEV();
@@ -3162,7 +3166,7 @@ function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
3166
return;
3167
}
3168
3165
- if ((fiber.effectTag & PassiveStatic) !== NoEffect) {
3169
+ if ((fiber.flags & PassiveStatic) !== NoFlags) {
3170
const updateQueue: FunctionComponentUpdateQueue | null = (fiber.updateQueue: any);
3171
if (updateQueue !== null) {
3172
const lastEffect = updateQueue.lastEffect;
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+35
-36
@@ -117,7 +117,7 @@ import {
117
} from './ReactWorkTags';
118
import {LegacyRoot} from './ReactRootTags';
119
import {
120
- NoEffect,
120
+ NoFlags,
121
PerformedWork,
122
Placement,
123
Update,
@@ -133,7 +133,7 @@ import {
133
HostEffectMask,
134
Hydrating,
135
HydratingAndUpdate,
136
-} from './ReactSideEffectTags';
136
+} from './ReactFiberFlags';
137
import {
138
NoLanePriority,
139
SyncLanePriority,
@@ -637,7 +637,7 @@ function markUpdateLaneFromFiberToRoot(
637
if (__DEV__) {
638
if (
639
alternate === null &&
640
- (sourceFiber.effectTag & (Placement | Hydrating)) !== NoEffect
640
+ (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags
641
) {
642
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
643
}
@@ -652,7 +652,7 @@ function markUpdateLaneFromFiberToRoot(
652
alternate.childLanes = mergeLanes(alternate.childLanes, lane);
653
} else {
654
if (__DEV__) {
655
- if ((parent.effectTag & (Placement | Hydrating)) !== NoEffect) {
655
+ if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
656
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
657
}
658
}
@@ -1693,7 +1693,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1693
const returnFiber = completedWork.return;
1694
1695
// Check if the work completed or if something threw.
1696
- if ((completedWork.effectTag & Incomplete) === NoEffect) {
1696
+ if ((completedWork.flags & Incomplete) === NoFlags) {
1697
setCurrentDebugFiberInDEV(completedWork);
1698
let next;
1699
if (
@@ -1720,7 +1720,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1720
if (
1721
returnFiber !== null &&
1722
// Do not append effects to parents if a sibling failed to complete
1723
- (returnFiber.effectTag & Incomplete) === NoEffect
1723
+ (returnFiber.flags & Incomplete) === NoFlags
1724
) {
1725
// Append all the effects of the subtree and this fiber onto the effect
1726
// list of the parent. The completion order of the children affects the
@@ -1741,12 +1741,12 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1741
// schedule our own side-effect on our own list because if end up
1742
// reusing children we'll schedule this effect onto itself since we're
1743
// at the end.
1744
- const effectTag = completedWork.effectTag;
1744
+ const flags = completedWork.flags;
1745
1746
// Skip both NoWork and PerformedWork tags when creating the effect
1747
// list. PerformedWork effect is read by React DevTools but shouldn't be
1748
// committed.
1749
- if (effectTag > PerformedWork) {
1749
+ if (flags > PerformedWork) {
1750
if (returnFiber.lastEffect !== null) {
1751
returnFiber.lastEffect.nextEffect = completedWork;
1752
} else {
@@ -1768,7 +1768,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1768
// back here again.
1769
// Since we're restarting, remove anything that is not a host effect
1770
// from the effect tag.
1771
- next.effectTag &= HostEffectMask;
1771
+ next.flags &= HostEffectMask;
1772
workInProgress = next;
1773
return;
1774
}
@@ -1793,7 +1793,7 @@ function completeUnitOfWork(unitOfWork: Fiber): void {
1793
if (returnFiber !== null) {
1794
// Mark the parent fiber as incomplete and clear its effect list.
1795
returnFiber.firstEffect = returnFiber.lastEffect = null;
1796
- returnFiber.effectTag |= Incomplete;
1796
+ returnFiber.flags |= Incomplete;
1797
}
1798
}
1799
@@ -1985,7 +1985,7 @@ function commitRootImpl(root, renderPriorityLevel) {
1985
1986
// Get the list of effects.
1987
let firstEffect;
1988
- if (finishedWork.effectTag > PerformedWork) {
1988
+ if (finishedWork.flags > PerformedWork) {
1989
// A fiber's effect list consists only of its children, not itself. So if
1990
// the root has an effect, we need to add it to the end of the list. The
1991
// resulting list is the set that would belong to the root's parent, if it
@@ -2161,7 +2161,7 @@ function commitRootImpl(root, renderPriorityLevel) {
2161
while (nextEffect !== null) {
2162
const nextNextEffect = nextEffect.nextEffect;
2163
nextEffect.nextEffect = null;
2164
- if (nextEffect.effectTag & Deletion) {
2164
+ if (nextEffect.flags & Deletion) {
2165
detachFiberAfterEffects(nextEffect);
2166
}
2167
nextEffect = nextNextEffect;
@@ -2272,7 +2272,7 @@ function commitBeforeMutationEffects() {
2272
const current = nextEffect.alternate;
2273
2274
if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) {
2275
- if ((nextEffect.effectTag & Deletion) !== NoEffect) {
2275
+ if ((nextEffect.flags & Deletion) !== NoFlags) {
2276
if (doesFiberContain(nextEffect, focusedInstanceHandle)) {
2277
shouldFireAfterActiveInstanceBlur = true;
2278
beforeActiveInstanceBlur();
@@ -2290,15 +2290,15 @@ function commitBeforeMutationEffects() {
2290
}
2291
}
2292
2293
- const effectTag = nextEffect.effectTag;
2294
- if ((effectTag & Snapshot) !== NoEffect) {
2293
+ const flags = nextEffect.flags;
2294
+ if ((flags & Snapshot) !== NoFlags) {
2295
setCurrentDebugFiberInDEV(nextEffect);
2296
2297
commitBeforeMutationEffectOnFiber(current, nextEffect);
2298
2299
resetCurrentDebugFiberInDEV();
2300
}
2301
- if ((effectTag & Passive) !== NoEffect) {
2301
+ if ((flags & Passive) !== NoFlags) {
2302
// If there are passive effects, schedule a callback to flush at
2303
// the earliest opportunity.
2304
if (!rootDoesHavePassiveEffects) {
@@ -2321,13 +2321,13 @@ function commitMutationEffects(
2321
while (nextEffect !== null) {
2322
setCurrentDebugFiberInDEV(nextEffect);
2323
2324
- const effectTag = nextEffect.effectTag;
2324
+ const flags = nextEffect.flags;
2325
2326
- if (effectTag & ContentReset) {
2326
+ if (flags & ContentReset) {
2327
commitResetTextContent(nextEffect);
2328
}
2329
2330
- if (effectTag & Ref) {
2330
+ if (flags & Ref) {
2331
const current = nextEffect.alternate;
2332
if (current !== null) {
2333
commitDetachRef(current);
@@ -2345,16 +2345,15 @@ function commitMutationEffects(
2345
// updates, and deletions. To avoid needing to add a case for every possible
2346
// bitmap value, we remove the secondary effects from the effect tag and
2347
// switch on that value.
2348
- const primaryEffectTag =
2349
- effectTag & (Placement | Update | Deletion | Hydrating);
2350
- switch (primaryEffectTag) {
2348
+ const primaryFlags = flags & (Placement | Update | Deletion | Hydrating);
2349
+ switch (primaryFlags) {
2350
case Placement: {
2351
commitPlacement(nextEffect);
2352
// Clear the "placement" from effect tag so that we know that this is
2353
// inserted, before any life-cycles like componentDidMount gets called.
2354
// TODO: findDOMNode doesn't rely on this any more but isMounted does
2355
// and isMounted is deprecated anyway so we should be able to kill this.
2357
- nextEffect.effectTag &= ~Placement;
2356
+ nextEffect.flags &= ~Placement;
2357
break;
2358
}
2359
case PlacementAndUpdate: {
@@ -2362,7 +2361,7 @@ function commitMutationEffects(
2361
commitPlacement(nextEffect);
2362
// Clear the "placement" from effect tag so that we know that this is
2363
// inserted, before any life-cycles like componentDidMount gets called.
2365
- nextEffect.effectTag &= ~Placement;
2364
+ nextEffect.flags &= ~Placement;
2365
2366
// Update
2367
const current = nextEffect.alternate;
@@ -2370,11 +2369,11 @@ function commitMutationEffects(
2369
break;
2370
}
2371
case Hydrating: {
2373
- nextEffect.effectTag &= ~Hydrating;
2372
+ nextEffect.flags &= ~Hydrating;
2373
break;
2374
}
2375
case HydratingAndUpdate: {
2377
- nextEffect.effectTag &= ~Hydrating;
2376
+ nextEffect.flags &= ~Hydrating;
2377
2378
// Update
2379
const current = nextEffect.alternate;
@@ -2417,9 +2416,9 @@ function commitLayoutEffects(root: FiberRoot, committedLanes: Lanes) {
2416
while (nextEffect !== null) {
2417
setCurrentDebugFiberInDEV(nextEffect);
2418
2420
- const effectTag = nextEffect.effectTag;
2419
+ const flags = nextEffect.flags;
2420
2422
- if (effectTag & (Update | Callback)) {
2421
+ if (flags & (Update | Callback)) {
2422
const current = nextEffect.alternate;
2423
commitLayoutEffectOnFiber(root, current, nextEffect, committedLanes);
2424
}
@@ -2427,11 +2426,11 @@ function commitLayoutEffects(root: FiberRoot, committedLanes: Lanes) {
2426
if (enableScopeAPI) {
2427
// TODO: This is a temporary solution that allowed us to transition away
2428
// from React Flare on www.
2430
- if (effectTag & Ref && nextEffect.tag !== ScopeComponent) {
2429
+ if (flags & Ref && nextEffect.tag !== ScopeComponent) {
2430
commitAttachRef(nextEffect);
2431
}
2432
} else {
2434
- if (effectTag & Ref) {
2433
+ if (flags & Ref) {
2434
commitAttachRef(nextEffect);
2435
}
2436
}
@@ -2509,10 +2508,10 @@ export function enqueuePendingPassiveHookEffectUnmount(
2508
): void {
2509
pendingPassiveHookEffectsUnmount.push(effect, fiber);
2510
if (__DEV__) {
2512
- fiber.effectTag |= PassiveUnmountPendingDev;
2511
+ fiber.flags |= PassiveUnmountPendingDev;
2512
const alternate = fiber.alternate;
2513
if (alternate !== null) {
2515
- alternate.effectTag |= PassiveUnmountPendingDev;
2514
+ alternate.flags |= PassiveUnmountPendingDev;
2515
}
2516
}
2517
if (!rootDoesHavePassiveEffects) {
@@ -2579,10 +2578,10 @@ function flushPassiveEffectsImpl() {
2578
effect.destroy = undefined;
2579
2580
if (__DEV__) {
2582
- fiber.effectTag &= ~PassiveUnmountPendingDev;
2581
+ fiber.flags &= ~PassiveUnmountPendingDev;
2582
const alternate = fiber.alternate;
2583
if (alternate !== null) {
2585
- alternate.effectTag &= ~PassiveUnmountPendingDev;
2584
+ alternate.flags &= ~PassiveUnmountPendingDev;
2585
}
2586
}
2587
@@ -2686,7 +2685,7 @@ function flushPassiveEffectsImpl() {
2685
const nextNextEffect = effect.nextEffect;
2686
// Remove nextEffect pointer to assist GC
2687
effect.nextEffect = null;
2689
- if (effect.effectTag & Deletion) {
2688
+ if (effect.flags & Deletion) {
2689
detachFiberAfterEffects(effect);
2690
}
2691
effect = nextNextEffect;
@@ -3092,7 +3091,7 @@ function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
3091
3092
// If there are pending passive effects unmounts for this Fiber,
3093
// we can assume that they would have prevented this update.
3095
- if ((fiber.effectTag & PassiveUnmountPendingDev) !== NoEffect) {
3094
+ if ((fiber.flags & PassiveUnmountPendingDev) !== NoFlags) {
3095
return;
3096
}
3097
packages/react-reconciler/src/ReactHookEffectTags.js
+2
-2
@@ -7,9 +7,9 @@
7
* @flow
8
*/
9
10
-export type HookEffectTag = number;
10
+export type HookFlags = number;
11
12
-export const NoEffect = /* */ 0b000;
12
+export const NoFlags = /* */ 0b000;
13
14
// Represents whether effect should fire.
15
export const HasEffect = /* */ 0b001;
packages/react-reconciler/src/ReactInternalTypes.js
+4
-4
@@ -19,8 +19,8 @@ import type {
19
import type {SuspenseInstance} from './ReactFiberHostConfig';
20
import type {WorkTag} from './ReactWorkTags';
21
import type {TypeOfMode} from './ReactTypeOfMode';
22
-import type {SideEffectTag} from './ReactSideEffectTags';
23
-import type {SubtreeTag} from './ReactSubtreeTags';
22
+import type {Flags} from './ReactFiberFlags';
23
+import type {SubtreeFlags} from './ReactSubtreeFlags';
24
import type {Lane, LanePriority, Lanes, LaneMap} from './ReactFiberLane';
25
import type {HookType} from './ReactFiberHooks.old';
26
import type {RootTag} from './ReactRootTags';
@@ -118,8 +118,8 @@ export type Fiber = {|
118
mode: TypeOfMode,
119
120
// Effect
121
- effectTag: SideEffectTag,
122
- subtreeTag: SubtreeTag,
121
+ flags: Flags,
122
+ subtreeFlags: SubtreeFlags,
123
deletions: Array<Fiber> | null,
124
125
// Singly linked list fast path to the next fiber with side-effects.
packages/react-reconciler/src/ReactSubtreeFlags.js
renamed
+3
-2
@@ -7,9 +7,10 @@
7
* @flow
8
*/
9
10
-export type SubtreeTag = number;
10
+// TODO: Move this to ReactFiberFlags so it's easier to line up the bits
11
+export type SubtreeFlags = number;
12
12
-export const NoEffect = /* */ 0b00000;
13
+export const NoFlags = /* */ 0b00000;
14
export const BeforeMutation = /* */ 0b00001;
15
export const Mutation = /* */ 0b00010;
16
export const Layout = /* */ 0b00100;
packages/react-reconciler/src/ReactUpdateQueue.new.js
+4
-4
@@ -92,7 +92,7 @@ import {
92
enterDisallowedContextReadInDEV,
93
exitDisallowedContextReadInDEV,
94
} from './ReactFiberNewContext.new';
95
-import {Callback, ShouldCapture, DidCapture} from './ReactSideEffectTags';
95
+import {Callback, ShouldCapture, DidCapture} from './ReactFiberFlags';
96
97
import {debugRenderPhaseSideEffectsForStrictMode} from 'shared/ReactFeatureFlags';
98
@@ -345,8 +345,8 @@ function getStateFromUpdate<State>(
345
return payload;
346
}
347
case CaptureUpdate: {
348
- workInProgress.effectTag =
349
- (workInProgress.effectTag & ~ShouldCapture) | DidCapture;
348
+ workInProgress.flags =
349
+ (workInProgress.flags & ~ShouldCapture) | DidCapture;
350
}
351
// Intentional fallthrough
352
case UpdateState: {
@@ -517,7 +517,7 @@ export function processUpdateQueue<State>(
517
);
518
const callback = update.callback;
519
if (callback !== null) {
520
- workInProgress.effectTag |= Callback;
520
+ workInProgress.flags |= Callback;
521
const effects = queue.effects;
522
if (effects === null) {
523
queue.effects = [update];
packages/react-reconciler/src/ReactUpdateQueue.old.js
+4
-4
@@ -92,7 +92,7 @@ import {
92
enterDisallowedContextReadInDEV,
93
exitDisallowedContextReadInDEV,
94
} from './ReactFiberNewContext.old';
95
-import {Callback, ShouldCapture, DidCapture} from './ReactSideEffectTags';
95
+import {Callback, ShouldCapture, DidCapture} from './ReactFiberFlags';
96
97
import {debugRenderPhaseSideEffectsForStrictMode} from 'shared/ReactFeatureFlags';
98
@@ -345,8 +345,8 @@ function getStateFromUpdate<State>(
345
return payload;
346
}
347
case CaptureUpdate: {
348
- workInProgress.effectTag =
349
- (workInProgress.effectTag & ~ShouldCapture) | DidCapture;
348
+ workInProgress.flags =
349
+ (workInProgress.flags & ~ShouldCapture) | DidCapture;
350
}
351
// Intentional fallthrough
352
case UpdateState: {
@@ -517,7 +517,7 @@ export function processUpdateQueue<State>(
517
);
518
const callback = update.callback;
519
if (callback !== null) {
520
- workInProgress.effectTag |= Callback;
520
+ workInProgress.flags |= Callback;
521
const effects = queue.effects;
522
if (effects === null) {
523
queue.effects = [update];
scripts/eslint-rules/__tests__/no-cross-fork-types-test.internal.js
+2
-2
@@ -74,9 +74,9 @@ const {key_new} = obj;
74
errors: [{message: oldAccessWarning}],
75
},
76
{
77
- code: 'const subtreeTag = obj.subtreeTag;',
77
+ code: 'const subtreeFlags = obj.subtreeFlags;',
78
filename: 'ReactFiberWorkLoop.old.js',
79
- options: [{new: ['subtreeTag']}],
79
+ options: [{new: ['subtreeFlags']}],
80
errors: [{message: newAccessWarning}],
81
},
82
{