Skip to content

Commit 09440f4

Browse files
author
Brian Vaughn
committed
Replaced ClearContainer tag with Snapshot for clearing HostRoots
1 parent 88d6d34 commit 09440f4

File tree

8 files changed

+28
-33
lines changed

8 files changed

+28
-33
lines changed

packages/react-dom/src/client/__tests__/trustedTypes-test.internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('when Trusted Types are available in global object', () => {
7474
container,
7575
);
7676
expect(container.innerHTML).toBe('<div><b>Hi</b></div>');
77-
// Second call to innerHTML is the ClearContainer check.
77+
// Second call to innerHTML is the clearContainer check.
7878
expect(innerHTMLCalls.length).toBe(2);
7979
// Ensure it didn't get stringified when passed to a DOM sink:
8080
expect(innerHTMLCalls[0]).toBe(ttObject1);

packages/react-reconciler/src/ReactFiberCommitWork.new.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ import {
6868
Snapshot,
6969
Update,
7070
Passive,
71-
ClearContainer,
7271
} from './ReactSideEffectTags';
7372
import getComponentName from 'shared/getComponentName';
7473
import invariant from 'shared/invariant';
@@ -297,7 +296,7 @@ function commitBeforeMutationLifeCycles(
297296
}
298297
case HostRoot: {
299298
if (supportsMutation) {
300-
if (finishedWork.effectTag & ClearContainer) {
299+
if (finishedWork.effectTag & Snapshot) {
301300
const root = finishedWork.stateNode;
302301
clearContainer(root.containerInfo);
303302
}

packages/react-reconciler/src/ReactFiberCommitWork.old.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ import {
6868
Snapshot,
6969
Update,
7070
Passive,
71-
ClearContainer,
7271
} from './ReactSideEffectTags';
7372
import getComponentName from 'shared/getComponentName';
7473
import invariant from 'shared/invariant';
@@ -297,7 +296,7 @@ function commitBeforeMutationLifeCycles(
297296
}
298297
case HostRoot: {
299298
if (supportsMutation) {
300-
if (finishedWork.effectTag & ClearContainer) {
299+
if (finishedWork.effectTag & Snapshot) {
301300
const root = finishedWork.stateNode;
302301
clearContainer(root.containerInfo);
303302
}

packages/react-reconciler/src/ReactFiberCompleteWork.new.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import {
6161
NoEffect,
6262
DidCapture,
6363
Deletion,
64-
ClearContainer,
64+
Snapshot,
6565
} from './ReactSideEffectTags';
6666
import invariant from 'shared/invariant';
6767

@@ -684,7 +684,7 @@ function completeWork(
684684
// This handles the case of React rendering into a container with previous children.
685685
// It's also safe to do for updates too, because current.child would only be null
686686
// if the previous render was null (so the the container would already be empty).
687-
workInProgress.effectTag |= ClearContainer;
687+
workInProgress.effectTag |= Snapshot;
688688
}
689689
}
690690
updateHostContainer(workInProgress);

packages/react-reconciler/src/ReactFiberCompleteWork.old.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import {
6161
NoEffect,
6262
DidCapture,
6363
Deletion,
64-
ClearContainer,
64+
Snapshot,
6565
} from './ReactSideEffectTags';
6666
import invariant from 'shared/invariant';
6767

@@ -684,7 +684,7 @@ function completeWork(
684684
// This handles the case of React rendering into a container with previous children.
685685
// It's also safe to do for updates too, because current.child would only be null
686686
// if the previous render was null (so the the container would already be empty).
687-
workInProgress.effectTag |= ClearContainer;
687+
workInProgress.effectTag |= Snapshot;
688688
}
689689
}
690690
updateHostContainer(workInProgress);

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ import {
112112
HostEffectMask,
113113
Hydrating,
114114
HydratingAndUpdate,
115-
ClearContainer,
116115
} from './ReactSideEffectTags';
117116
import {
118117
NoWork,
@@ -2064,7 +2063,7 @@ function commitBeforeMutationEffects() {
20642063
beforeActiveInstanceBlur();
20652064
}
20662065
const effectTag = nextEffect.effectTag;
2067-
if ((effectTag & (Snapshot | ClearContainer)) !== NoEffect) {
2066+
if ((effectTag & Snapshot) !== NoEffect) {
20682067
setCurrentDebugFiberInDEV(nextEffect);
20692068

20702069
const current = nextEffect.alternate;

packages/react-reconciler/src/ReactFiberWorkLoop.old.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ import {
123123
HostEffectMask,
124124
Hydrating,
125125
HydratingAndUpdate,
126-
ClearContainer,
127126
} from './ReactSideEffectTags';
128127
import {
129128
NoWork,
@@ -2168,7 +2167,7 @@ function commitBeforeMutationEffects() {
21682167
beforeActiveInstanceBlur();
21692168
}
21702169
const effectTag = nextEffect.effectTag;
2171-
if ((effectTag & (Snapshot | ClearContainer)) !== NoEffect) {
2170+
if ((effectTag & Snapshot) !== NoEffect) {
21722171
setCurrentDebugFiberInDEV(nextEffect);
21732172

21742173
const current = nextEffect.alternate;

packages/react-reconciler/src/ReactSideEffectTags.js

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,29 @@
1010
export type SideEffectTag = number;
1111

1212
// Don't change these two values. They're used by React Dev Tools.
13-
export const NoEffect = /* */ 0b000000000000000;
14-
export const PerformedWork = /* */ 0b000000000000001;
13+
export const NoEffect = /* */ 0b00000000000000;
14+
export const PerformedWork = /* */ 0b00000000000001;
1515

1616
// You can change the rest (and add more).
17-
export const Placement = /* */ 0b000000000000010;
18-
export const Update = /* */ 0b000000000000100;
19-
export const PlacementAndUpdate = /* */ 0b000000000000110;
20-
export const Deletion = /* */ 0b000000000001000;
21-
export const ContentReset = /* */ 0b000000000010000;
22-
export const Callback = /* */ 0b000000000100000;
23-
export const DidCapture = /* */ 0b000000001000000;
24-
export const Ref = /* */ 0b000000010000000;
25-
export const Snapshot = /* */ 0b000000100000000;
26-
export const Passive = /* */ 0b000001000000000;
27-
export const PassiveUnmountPendingDev = /* */ 0b010000000000000;
28-
export const Hydrating = /* */ 0b000010000000000;
29-
export const HydratingAndUpdate = /* */ 0b000010000000100;
30-
export const ClearContainer = /* */ 0b100000000000000;
17+
export const Placement = /* */ 0b00000000000010;
18+
export const Update = /* */ 0b00000000000100;
19+
export const PlacementAndUpdate = /* */ 0b00000000000110;
20+
export const Deletion = /* */ 0b00000000001000;
21+
export const ContentReset = /* */ 0b00000000010000;
22+
export const Callback = /* */ 0b00000000100000;
23+
export const DidCapture = /* */ 0b00000001000000;
24+
export const Ref = /* */ 0b00000010000000;
25+
export const Snapshot = /* */ 0b00000100000000;
26+
export const Passive = /* */ 0b00001000000000;
27+
export const PassiveUnmountPendingDev = /* */ 0b10000000000000;
28+
export const Hydrating = /* */ 0b00010000000000;
29+
export const HydratingAndUpdate = /* */ 0b00010000000100;
3130

3231
// Passive & Update & Callback & Ref & Snapshot
33-
export const LifecycleEffectMask = /* */ 0b000001110100100;
32+
export const LifecycleEffectMask = /* */ 0b00001110100100;
3433

3534
// Union of all host effects
36-
export const HostEffectMask = /* */ 0b000011111111111;
35+
export const HostEffectMask = /* */ 0b00011111111111;
3736

38-
export const Incomplete = /* */ 0b000100000000000;
39-
export const ShouldCapture = /* */ 0b001000000000000;
37+
export const Incomplete = /* */ 0b00100000000000;
38+
export const ShouldCapture = /* */ 0b01000000000000;

0 commit comments

Comments
 (0)