Fix dynamic frame callback activation - #275
Draft
brandtnewlabs wants to merge 2 commits into
Draft
Conversation
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
staticchanges after mountuseFrameCallbacksites use constant activation or already synchronize itstaticcan be toggled at runtime and add regression coverage for live → static → live transitionsThis is a focused follow-up stacked on #274 and addresses the broader audit raised in #273.
Audit result
Reanimated's
autostartargument seeds the callback's active state when the hook mounts; changing the argument later does not update that state. Every callback whose activation can change during the component lifetime now calls the returned handle'ssetActivemethod from an effect.The remaining callback sites are safe because their activation is constant for the mounted component, are conditionally mounted with the feature, or already synchronize the returned handle.
Verification
npm run typechecknpm run lintnpm test -- --silent— 104 suites, 1,580 passing testsBefore
The static → live chart keeps a frozen engine clock, retains the stale candle
width, emits no trade labels, and misses the visible marker. The live → static
chart keeps advancing instead of suspending its frame work.
▶ Watch or download the before video
After
The same scenario resumes the engine, renders the new candle width and trades,
hits the marker, and freezes every frame loop again when returning to static.
▶ Watch or download the after video