mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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.
This commit is contained in:
@@ -178,12 +178,18 @@ function hadNoMutationsEffects(current: null | Fiber, completedWork: Fiber) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((completedWork.flags & Deletion) !== NoFlags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: If we move the `hadNoMutationsEffects` call after `bubbleProperties`
|
||||
// then we only have to check the `completedWork.subtreeFlags`.
|
||||
let child = completedWork.child;
|
||||
while (child !== null) {
|
||||
if ((child.flags & MutationMask) !== NoFlags) {
|
||||
if ((child.flags & (MutationMask | Deletion)) !== NoFlags) {
|
||||
return false;
|
||||
}
|
||||
if ((child.subtreeFlags & MutationMask) !== NoFlags) {
|
||||
if ((child.subtreeFlags & (MutationMask | Deletion)) !== NoFlags) {
|
||||
return false;
|
||||
}
|
||||
child = child.sibling;
|
||||
|
||||
Reference in New Issue
Block a user