SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 155 C++

Avoid expensive exception throw in SynchronousMountItem for stopped surfaces (#56969)

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

When a `SynchronousMountItem` is dispatched for a reactTag whose surface has already been torn down, the `RetryableMountingLayerException ` is thrown in `storeSynchronousMountPropsOverride` and `updatePropsSynchronously`. The exception was immediately caught in the `SynchronousMountItem.execute`, making it a costly no-op. For each throw the stack trace is captured while holding the ART mutator lock in shared mode. On devices with high thread counts and deep Choreographer call stacks, this contributes to ANR during `doFrame`.

This diff switches `storeSynchronousMountPropsOverride` and `updatePropsSynchronously` to use the nullable `getSurfaceManagerForView` variant, which returns null and silently no-ops when the surface is missing — the same end behavior as before, without the exception overhead.

Changelog:
[Internal]

Reviewed By: zeyap

Differential Revision: D106094737

fbshipit-source-id: df19657acbf6f66c2489d31e7c91c4a5c1e4f0fc
D
Dawid Małecki committed
54b9af1a30bddb72237f6677c5379b165df90724
Parent: abcb782
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 5/26/2026, 3:43:13 PM