Skip to content

Do not flush Animated operation queue on mount for some feature flags#51461

Closed
rozele wants to merge 2 commits into
facebook:mainfrom
rozele:export-D75003751
Closed

Do not flush Animated operation queue on mount for some feature flags#51461
rozele wants to merge 2 commits into
facebook:mainfrom
rozele:export-D75003751

Conversation

@rozele
Copy link
Copy Markdown
Contributor

@rozele rozele commented May 19, 2025

Summary:
We are trying to minimize the amount of non-determinism in flushing Animated operation queues. Initiallly the ReactNativeFeatureFlags.animatedShouldSignalBatch handled non-determinism on the native side, eliminating the use of native mount hooks to trigger operation batch flushes in the native module. However, there is additional non-determinism introduced by JS, where the set of pending Animated operations may be flushed as a result of an effect.

This change eliminates the flushing of Animated operations in the useEffect for createAnimatedPropsHook.js.

Changelog

[Internal]

Differential Revision: D75003751

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels May 19, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D75003751

rozele added 2 commits May 19, 2025 11:04
…dSignalBatch (facebook#51459)

Summary:

When using `animatedShouldSignalBatch` in combination with `animatedShouldUseSingleOp`, we were seeing an issue where the queue is not flushed deterministically. It would be flushed in an ad-hoc manner by `createAnimatedPropsHook.js`, but this was only if a mount happened to occur in the same frame.

Adding a deterministic queue flush mechanism to the logic handling `animatedShouldUseSingleOp` appears to resolve the issue.

## Changelog

[Internal]

Reviewed By: javache

Differential Revision: D75002657
…facebook#51461)

Summary:

We are trying to minimize the amount of non-determinism in flushing Animated operation queues. Initially the `ReactNativeFeatureFlags.animatedShouldSignalBatch` handled non-determinism on the native side, eliminating the use of native mount hooks to trigger operation batch flushes in the native module. However, there is additional non-determinism introduced by JS, where the set of pending Animated operations may be flushed as a result of an effect.

This change eliminates the flushing of Animated operations in the `useEffect` for `createAnimatedPropsHook.js`.

## Changelog

[Internal]

Reviewed By: yungsters, zeyap

Differential Revision: D75003751
@rozele rozele force-pushed the export-D75003751 branch from bc87dbd to 2d11d63 Compare May 19, 2025 18:04
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D75003751

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label May 19, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 2f761ee.

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. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants