Seal RootShadowNode just before it is promoted (#39355)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39355

changelog: [internal]

We want to seal node just before it is promoted.

Reviewed By: javache, NickGerleman

Differential Revision: D49054011

fbshipit-source-id: 92550c13280c68bf66d505872d86d775cf115f5d
This commit is contained in:
Samuel Susla
2023-09-12 06:55:37 -07:00
committed by Facebook GitHub Bot
parent 06b5c6e9e0
commit 2153184c77
@@ -371,9 +371,6 @@ CommitStatus ShadowTree::tryCommit(
telemetry.unsetAsThreadLocal();
telemetry.didLayout(affectedLayoutableNodes.size());
// Seal the shadow node so it can no longer be mutated
newRootShadowNode->sealRecursive();
{
// Updating `currentRevision_` in unique manner if it hasn't changed.
std::unique_lock lock(commitMutex_);
@@ -409,6 +406,9 @@ CommitStatus ShadowTree::tryCommit(
telemetry.didCommit();
telemetry.setRevisionNumber(static_cast<int>(newRevisionNumber));
// Seal the shadow node so it can no longer be mutated
newRootShadowNode->sealRecursive();
newRevision = ShadowTreeRevision{
std::move(newRootShadowNode), newRevisionNumber, telemetry};