diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp index 6d9ea43bffb..3fe931d6651 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp @@ -178,6 +178,8 @@ void ShadowNode::appendChild(const ShadowNode::Shared &child) { nonConstChildren->push_back(child); child->family_->setParent(family_); + + stateRevision_ += child->getStateRevision(); } void ShadowNode::replaceChild( @@ -186,6 +188,8 @@ void ShadowNode::replaceChild( int suggestedIndex) { ensureUnsealed(); + stateRevision_ += newChild->getStateRevision() - oldChild.getStateRevision(); + cloneChildrenIfShared(); newChild->family_->setParent(family_); diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.h b/ReactCommon/fabric/core/shadownode/ShadowNode.h index 08de4454529..223d189c282 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.h +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.h @@ -171,12 +171,11 @@ class ShadowNode : public virtual Sealable, friend ShadowNodeFamily; /** - * This number is deterministically, statelessly recomputable (it's dependent - * only on the immutable properties stored in this class). It tells us the - * version of the state of the entire subtree, including this component and - * all descendants. + * This number is deterministically, statelessly recomputable . It tells us + * the version of the state of the entire subtree, including this component + * and all descendants. */ - int const stateRevision_; + int stateRevision_; /* * Clones the list of children (and creates a new `shared_ptr` to it) if