Skip to content

Commit

Permalink
Call updateMountedFlag in ShadowTree::tryCommit only if commit will g…
Browse files Browse the repository at this point in the history
…o 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
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Jan 28, 2021
1 parent 99b7052 commit 78df536
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ReactCommon/react/renderer/mounting/ShadowTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ CommitStatus ShadowTree::tryCommit(
newRootShadowNode = delegate_.shadowTreeWillCommit(
*this, oldRootShadowNode, newRootShadowNode);

if (!newRootShadowNode) {
if (!newRootShadowNode ||
(commitOptions.shouldCancel && commitOptions.shouldCancel())) {
return CommitStatus::Cancelled;
}

Expand All @@ -392,10 +393,6 @@ CommitStatus ShadowTree::tryCommit(
currentRevision_ = newRevision;
}

if (commitOptions.shouldCancel && commitOptions.shouldCancel()) {
return CommitStatus::Cancelled;
}

emitLayoutEvents(affectedLayoutableNodes);

if (commitMode == CommitMode::Normal) {
Expand Down

0 comments on commit 78df536

Please sign in to comment.