Skip to content

Return null from resolveView for stopped surfaces#55737

Closed
javache wants to merge 1 commit intofacebook:mainfrom
javache:export-D94347789
Closed

Return null from resolveView for stopped surfaces#55737
javache wants to merge 1 commit intofacebook:mainfrom
javache:export-D94347789

Conversation

@javache
Copy link
Copy Markdown
Member

@javache javache commented Feb 25, 2026

Summary:
FabricUIManager.resolveView can throw IllegalViewOperationException when called with a tag belonging to a stopped surface. This happens because getSurfaceManagerForView returns a stopped SurfaceMountingManager (via tagSetForStoppedSurface), but getView then throws since tagToViewState was cleared during stopSurface().

Add an isStopped() check before calling getView, returning null instead. This follows the same pattern already used by measure() and measureText() in the same file.

Changelog: [Internal]

Fixes T257147576.

Differential Revision: D94347789

Summary:
`FabricUIManager.resolveView` can throw `IllegalViewOperationException` when called with a tag belonging to a stopped surface. This happens because `getSurfaceManagerForView` returns a stopped `SurfaceMountingManager` (via `tagSetForStoppedSurface`), but `getView` then throws since `tagToViewState` was cleared during `stopSurface()`.

Add an `isStopped()` check before calling `getView`, returning `null` instead. This follows the same pattern already used by `measure()` and `measureText()` in the same file.

Changelog: [Internal]

Fixes T257147576.

Differential Revision: D94347789
@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 Feb 25, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Feb 25, 2026

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

Copy link
Copy Markdown
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync bot closed this in 117f3c9 Feb 25, 2026
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 25, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Feb 25, 2026

This pull request has been merged in 117f3c9.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @javache in 117f3c9

When will my fix make it into a release? | How to file a pick request?

@javache javache deleted the export-D94347789 branch February 26, 2026 14:04
zoontek pushed a commit to zoontek/react-native that referenced this pull request Mar 9, 2026
Summary:
Pull Request resolved: facebook#55737

`FabricUIManager.resolveView` can throw `IllegalViewOperationException` when called with a tag belonging to a stopped surface. This happens because `getSurfaceManagerForView` returns a stopped `SurfaceMountingManager` (via `tagSetForStoppedSurface`), but `getView` then throws since `tagToViewState` was cleared during `stopSurface()`.

Add an `isStopped()` check before calling `getView`, returning `null` instead. This follows the same pattern already used by `measure()` and `measureText()` in the same file.

Changelog: [Internal]

Fixes T257147576.

Reviewed By: cortinico

Differential Revision: D94347789

fbshipit-source-id: 0f68e0ffc8b2c891aa33c408e427acd7e1e5b829
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. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants