Skip to content

Clear AnimatedPropsRegistry on surface stop (#56485)#56485

Closed
zeyap wants to merge 1 commit into
react:mainfrom
zeyap:export-D101354994
Closed

Clear AnimatedPropsRegistry on surface stop (#56485)#56485
zeyap wants to merge 1 commit into
react:mainfrom
zeyap:export-D101354994

Conversation

@zeyap

@zeyap zeyap commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Summary:

Changelog:

[Internal] [Fixed] - Clear AnimatedPropsRegistry on surface stop

When useSharedAnimatedBackend is enabled, the AnimatedPropsRegistry accumulates
SurfaceContext entries (containing shared_ptr<ShadowNodeFamily> and PropsSnapshot
data) for each surface that has animated views. These entries are never cleaned up when
a surface is destroyed via UIManager::stopSurface(), because that method only calls
the legacy stopSurfaceForAnimationDelegate() — the shared backend's registry is untouched.

We also see increased RetryableMountingLayerException errors in production which stack trace
shows there are mount items committing to surface that no longer exists.

This change:

  1. Adds animationBackend_->clearRegistry(surfaceId) to UIManager::stopSurface()
  2. Changes AnimatedPropsRegistry::clear() to fully erase the surfaceContexts_ map
    entry instead of just clearing its contents

Reviewed By: christophpurrer

Differential Revision: D101354994

@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 Apr 17, 2026
@meta-codesync

meta-codesync Bot commented Apr 17, 2026

Copy link
Copy Markdown

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

@zeyap zeyap force-pushed the export-D101354994 branch from a501e6f to ddbb31b Compare April 17, 2026 14:40
@meta-codesync meta-codesync Bot changed the title Clear AnimatedPropsRegistry on surface stop Clear AnimatedPropsRegistry on surface stop (#56485) Apr 17, 2026
@zeyap zeyap force-pushed the export-D101354994 branch 12 times, most recently from 3b0b562 to 7258050 Compare April 20, 2026 10:47
Summary:
Pull Request resolved: #56485

## Changelog:

[Internal] [Fixed] - Clear AnimatedPropsRegistry on surface stop

When `useSharedAnimatedBackend` is enabled, the `AnimatedPropsRegistry` accumulates
`SurfaceContext` entries (containing `shared_ptr<ShadowNodeFamily>` and `PropsSnapshot`
data) for each surface that has animated views. These entries are never cleaned up when
a surface is destroyed via `UIManager::stopSurface()`, because that method only calls
the legacy `stopSurfaceForAnimationDelegate()` — the shared backend's registry is untouched.

We also see increased `RetryableMountingLayerException` errors in production which stack trace
shows there are mount items committing to surface that no longer exists.

This change:
1. Adds `animationBackend_->clearRegistry(surfaceId)` to `UIManager::stopSurface()`
2. Changes `AnimatedPropsRegistry::clear()` to fully erase the `surfaceContexts_` map
   entry instead of just clearing its contents

Reviewed By: christophpurrer

Differential Revision: D101354994
@zeyap zeyap force-pushed the export-D101354994 branch from 7258050 to b452798 Compare April 20, 2026 10:53
@meta-codesync meta-codesync Bot closed this in 1433e43 Apr 20, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label Apr 20, 2026
@meta-codesync

meta-codesync Bot commented Apr 20, 2026

Copy link
Copy Markdown

This pull request has been merged in 1433e43.

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @zeyap in 1433e43

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

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.

2 participants