diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/ReactCommon/react/renderer/mounting/ShadowTree.cpp index 6006539eb0a..7350dbc9d6b 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -248,7 +248,7 @@ ShadowTree::ShadowTree( family)); currentRevision_ = ShadowTreeRevision{ - rootShadowNode, ShadowTreeRevision::Number{0}, TransactionTelemetry{}}; + rootShadowNode, INITIAL_REVISION, TransactionTelemetry{}}; mountingCoordinator_ = std::make_shared(currentRevision_); @@ -275,7 +275,9 @@ void ShadowTree::setCommitMode(CommitMode commitMode) const { revision = currentRevision_; } - if (commitMode == CommitMode::Normal) { + // initial revision never contains any commits so mounting it here is + // incorrect + if (commitMode == CommitMode::Normal && revision.number != INITIAL_REVISION) { mount(revision); } } diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.h b/ReactCommon/react/renderer/mounting/ShadowTree.h index fd90b735497..2a8f1d1fadd 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.h +++ b/ReactCommon/react/renderer/mounting/ShadowTree.h @@ -124,6 +124,8 @@ class ShadowTree final { MountingCoordinator::Shared getMountingCoordinator() const; private: + constexpr static ShadowTreeRevision::Number INITIAL_REVISION{0}; + void mount(ShadowTreeRevision const &revision) const; void emitLayoutEvents(