Skip to content

Commit b44e4b1

Browse files
authored
Check for deletions in hadNoMutationsEffects (#20252)
When detecting if a host tree was changed, we must check for deletions in addition to mounts and updates.
1 parent 3ebf051 commit b44e4b1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,18 @@ function hadNoMutationsEffects(current: null | Fiber, completedWork: Fiber) {
178178
return true;
179179
}
180180

181+
if ((completedWork.flags & Deletion) !== NoFlags) {
182+
return false;
183+
}
184+
185+
// TODO: If we move the `hadNoMutationsEffects` call after `bubbleProperties`
186+
// then we only have to check the `completedWork.subtreeFlags`.
181187
let child = completedWork.child;
182188
while (child !== null) {
183-
if ((child.flags & MutationMask) !== NoFlags) {
189+
if ((child.flags & (MutationMask | Deletion)) !== NoFlags) {
184190
return false;
185191
}
186-
if ((child.subtreeFlags & MutationMask) !== NoFlags) {
192+
if ((child.subtreeFlags & (MutationMask | Deletion)) !== NoFlags) {
187193
return false;
188194
}
189195
child = child.sibling;

0 commit comments

Comments
 (0)