Fix stop() firing extra update on object animations#3586
Fix stop() firing extra update on object animations#3586mattgperry wants to merge 1 commit intomainfrom
Conversation
Remove the tick() call in JSAnimation.stop() that was scheduling a VisualElement render after the animation was supposedly stopped. The tick triggered onUpdate → motionValue.set → scheduleRender, causing one extra frame to update the target object after stop() returned. Fixes #3336 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR fixes a bug where calling The fix removes the
The fix aligns with the expected behavior: Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 9d27a00 |
Summary
stop()on an object animation (e.g. animating a Proxy), one extra update was fired on the next frame, modifying the target object afterstop()had returnedJSAnimation.stop()calledthis.tick(time.now())which triggered theonUpdate→motionValue.set()→scheduleRender()chain, scheduling a VisualElement render for the next frame. Theteardown()only cancelled the animation's update callback, not the pending rendertick()call fromstop(). The motionValue already holds its value from the last rendered frame, which is sufficientFixes #3336
Test plan
settrap counter, animates it withrepeat: Infinity, callsstop(), then asserts no additional updates fireyarn buildpassesyarn testpasses (only pre-existing flakyuse-instant-transitiontimeout unrelated to this change)🤖 Generated with Claude Code