A framework for building native applications using React
Remove tag from allocatedViewRegistry in destroyUnmountedShadowNode (#56274)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56274 When a ShadowNode is destroyed (e.g. from a superseded concurrent render or React Transition), destroyUnmountedShadowNode calls Java destroyUnmountedView which deletes the view from tagToViewState. However, the C++ allocatedViewRegistry was not updated, leaving a stale entry. This causes a crash when a subsequent executeMount encounters a Create mutation for the same tag: allocatedViewTags.contains(tag) returns true (stale entry from preallocate), so the Create mount item is skipped. But the Java view was already destroyed. When subsequent mount items (Insert, UpdateState, etc.) try to reference the tag, getViewState() throws RetryableMountingLayerException because the tag is not in tagToViewState. The fix mirrors what the normal Delete mutation path already does (line 638: allocatedViewTags.erase(tag)) - ensuring allocatedViewRegistry stays in sync with the Java-side tagToViewState. Changelog: [Android][Fixed] - Fix crash from stale preallocated view registry after concurrent render cancellation Reviewed By: lenaic Differential Revision: D98729251 fbshipit-source-id: 1a837138622b29bb62e31fb67aacb2c9ff4e9e5d
P
Pieter De Baets committed
97cf2202ee4b0f8c36716073509b50414e0f2c94
Parent: 2d78a39
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com>
on 3/31/2026, 3:09:31 PM