Fix IllegalStateException in SurfaceMountingManager.removeViewAt (#57860) - #57860
Open
cortinico wants to merge 1 commit into
Open
Fix IllegalStateException in SurfaceMountingManager.removeViewAt (#57860)#57860cortinico wants to merge 1 commit into
cortinico wants to merge 1 commit into
Conversation
|
@cortinico has exported this pull request. If you are a Meta employee, you can view the originating Diff in D115211130. |
cortinico
added a commit
to cortinico/react-native
that referenced
this pull request
Aug 7, 2026
…ct#57860) Summary: Fix a crash in `SurfaceMountingManager.removeViewAt()` where an `IllegalStateException` is thrown when the parent view is not a `ViewGroup`. The Fabric differ can emit inconsistent remove instructions that reference a parent whose instantiated view is no longer a `ViewGroup` (e.g. after view recycling). Since a non-`ViewGroup` cannot hold child views, the removal is a semantic no-op. Replace the hard throw with `ReactSoftExceptionLogger.logSoftException` + early return, matching the defensive pattern already used by peer conditions in the same method (null `parentViewState`, child already removed, wrong index). Also fixes a "a a" typo in the error message. [Session trajectory link](https://www.internalfb.com/intern/devai/devmate/inspector/?id=6e4f3440-7815-4fc9-a981-f1603aea521b) Differential Revision: D115211130
cortinico
force-pushed
the
export-D115211130
branch
from
August 7, 2026 19:03
df6ff66 to
7b165b5
Compare
cortinico
added a commit
to cortinico/react-native
that referenced
this pull request
Aug 7, 2026
…ct#57860) Summary: Fix a crash in `SurfaceMountingManager.removeViewAt()` where an `IllegalStateException` is thrown when the parent view is not a `ViewGroup`. The Fabric differ can emit inconsistent remove instructions that reference a parent whose instantiated view is no longer a `ViewGroup` (e.g. after view recycling). Since a non-`ViewGroup` cannot hold child views, the removal is a semantic no-op. Replace the hard throw with `ReactSoftExceptionLogger.logSoftException` + early return, matching the defensive pattern already used by peer conditions in the same method (null `parentViewState`, child already removed, wrong index). Also fixes a "a a" typo in the error message. [Session trajectory link](https://www.internalfb.com/intern/devai/devmate/inspector/?id=6e4f3440-7815-4fc9-a981-f1603aea521b) Differential Revision: D115211130
cortinico
force-pushed
the
export-D115211130
branch
from
August 7, 2026 19:05
7b165b5 to
3be6733
Compare
cortinico
added a commit
to cortinico/react-native
that referenced
this pull request
Aug 7, 2026
…ct#57860) Summary: Fix a crash in `SurfaceMountingManager.removeViewAt()` where an `IllegalStateException` is thrown when the parent view is not a `ViewGroup`. The Fabric differ can emit inconsistent remove instructions that reference a parent whose instantiated view is no longer a `ViewGroup` (e.g. after view recycling). Since a non-`ViewGroup` cannot hold child views, the removal is a semantic no-op. Replace the hard throw with `ReactSoftExceptionLogger.logSoftException` + early return, matching the defensive pattern already used by peer conditions in the same method (null `parentViewState`, child already removed, wrong index). Also fixes a "a a" typo in the error message. [Session trajectory link](https://www.internalfb.com/intern/devai/devmate/inspector/?id=6e4f3440-7815-4fc9-a981-f1603aea521b) Reviewed By: zeyap Differential Revision: D115211130
cortinico
force-pushed
the
export-D115211130
branch
from
August 7, 2026 20:33
3be6733 to
1920165
Compare
…ct#57860) Summary: Fix a crash in `SurfaceMountingManager.removeViewAt()` where an `IllegalStateException` is thrown when the parent view is not a `ViewGroup`. The Fabric differ can emit inconsistent remove instructions that reference a parent whose instantiated view is no longer a `ViewGroup` (e.g. after view recycling). Since a non-`ViewGroup` cannot hold child views, the removal is a semantic no-op. Replace the hard throw with `ReactSoftExceptionLogger.logSoftException` + early return, matching the defensive pattern already used by peer conditions in the same method (null `parentViewState`, child already removed, wrong index). Also fixes a "a a" typo in the error message. [Session trajectory link](https://www.internalfb.com/intern/devai/devmate/inspector/?id=6e4f3440-7815-4fc9-a981-f1603aea521b) Reviewed By: zeyap Differential Revision: D115211130
cortinico
force-pushed
the
export-D115211130
branch
from
August 7, 2026 20:34
1920165 to
e853757
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Fix a crash in
SurfaceMountingManager.removeViewAt()where anIllegalStateExceptionis thrown when the parent view is not aViewGroup.The Fabric differ can emit inconsistent remove instructions that reference a parent whose instantiated view is no longer a
ViewGroup(e.g. after view recycling). Since a non-ViewGroupcannot hold child views, the removal is a semantic no-op.Replace the hard throw with
ReactSoftExceptionLogger.logSoftException+ early return, matching the defensive pattern already used by peer conditions in the same method (nullparentViewState, child already removed, wrong index). Also fixes a "a a" typo in the error message.Session trajectory link
Reviewed By: zeyap
Differential Revision: D115211130