Skip to content

Commit dabb434

Browse files
javachemeta-codesync[bot]
authored andcommitted
Fix RetryableMountingLayerException crash in updateOverflowInset (#56762)
Summary: Pull Request resolved: #56762 Fix a crash in `SurfaceMountingManager.updateOverflowInset()` where `getViewState()` throws `RetryableMountingLayerException` when the view state for a tag is not found in the registry. The crash occurs during batch mount item execution when an `updateOverflowInset` operation references a view tag that has been removed from the registry due to normal lifecycle race conditions. The surface is still active (not stopped), but the view has already been deleted. The fix replaces `getViewState(reactTag)` (which throws) with `getNullableViewState(reactTag)` + null check + soft exception logging + early return. This matches the defensive pattern already used by peer methods in the same class: `updateLayout`, `addViewAt`, and `removeViewAt`. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D104400233 fbshipit-source-id: 678df406079da98c0c2180766c936b5f2bb9fcf7
1 parent d80377c commit dabb434

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,16 @@ internal constructor(
898898
return
899899
}
900900

901-
val viewState = getViewState(reactTag)
901+
val viewState = getNullableViewState(reactTag)
902+
if (viewState == null) {
903+
ReactSoftExceptionLogger.logSoftException(
904+
ReactSoftExceptionLogger.Categories.SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE,
905+
ReactNoCrashSoftException(
906+
"Unable to find viewState for tag $reactTag for updateOverflowInset"
907+
),
908+
)
909+
return
910+
}
902911
// Do not layout Root Views
903912
if (viewState.isRoot) {
904913
return

0 commit comments

Comments
 (0)