Skip to content

Fix IllegalStateException in SurfaceMountingManager.removeViewAt (#57860) - #57860

Open
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D115211130
Open

Fix IllegalStateException in SurfaceMountingManager.removeViewAt (#57860)#57860
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D115211130

Conversation

@cortinico

@cortinico cortinico commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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

Reviewed By: zeyap

Differential Revision: D115211130

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 7, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Aug 7, 2026
@meta-codesync

meta-codesync Bot commented Aug 7, 2026

Copy link
Copy Markdown

@cortinico has exported this pull request. If you are a Meta employee, you can view the originating Diff in D115211130.

@meta-codesync meta-codesync Bot changed the title Fix IllegalStateException in SurfaceMountingManager.removeViewAt Fix IllegalStateException in SurfaceMountingManager.removeViewAt (#57860) Aug 7, 2026
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 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 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
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant