Call updateMountedFlag in ShadowTree::tryCommit only if commit will go to native

Summary:
Changelog: [internal]

`updateMountedFlag` needs to be called only when new revision will be mounted. In case a commit is throttled, this wasn't the case. Therefore, moving cancellation of commit so it happens before `updateMountedFlag`. We already cancel commits on that place so it should be safe.

Reviewed By: shergin

Differential Revision: D26049262

fbshipit-source-id: e0ecdd2d8f0cdb09d0c0a07ad3931ce77bcf03cf
This commit is contained in:
Samuel Susla
2021-01-28 04:43:25 -08:00
committed by Facebook GitHub Bot
parent 99b7052248
commit 78df536c78
@@ -371,7 +371,8 @@ CommitStatus ShadowTree::tryCommit(
newRootShadowNode = delegate_.shadowTreeWillCommit(
*this, oldRootShadowNode, newRootShadowNode);
if (!newRootShadowNode) {
if (!newRootShadowNode ||
(commitOptions.shouldCancel && commitOptions.shouldCancel())) {
return CommitStatus::Cancelled;
}
@@ -392,10 +393,6 @@ CommitStatus ShadowTree::tryCommit(
currentRevision_ = newRevision;
}
if (commitOptions.shouldCancel && commitOptions.shouldCancel()) {
return CommitStatus::Cancelled;
}
emitLayoutEvents(affectedLayoutableNodes);
if (commitMode == CommitMode::Normal) {