fix: restart animation loop when stale requestAnimationFrame exists - #1015
Open
ishubhamrathi wants to merge 2 commits into
Open
fix: restart animation loop when stale requestAnimationFrame exists#1015ishubhamrathi wants to merge 2 commits into
ishubhamrathi wants to merge 2 commits into
Conversation
…nFrame guard. Related issue: DavidHDev#1014
Cancel the existing animation frame before starting a new one.
Owner
|
Have you checked the other 3 variants of each of these affected components? The change should be made everywhere. |
Author
I verified the other three variants while reproducing the issue. They use different implementations and don't exhibit this behavior, so this fix is only needed for OptionWheel and LineSidebar. |
Owner
|
@ishubhamrathi what I mean is, OptionWheel and LineSidebar both have 3 other files where the code is esentially the same. The library has 4 variants to each component (JS+CSS, JS+TAILWIND, TS+CSS, TS+TAILWIND). You only modified the JS+CSS versions in this PR, when all 3 others must be kept in sync. |
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
This PR fixes an animation loop issue affecting multiple components that use the same
requestAnimationFramescheduling pattern.Root Cause
The animation loop was guarded with:
If
rafRef.currentcontained a previously scheduled animation frame ID,startLoop()exited early without scheduling a new frame. This could prevent the animation loop from restarting, causing interactive animations to stop responding.Fix
Restart the animation loop by cancelling any previously scheduled frame before requesting a new one.
Components Updated
Testing
Verified that the affected components correctly restart their animation loop and interactive animations (hover, selection, etc.) now work as expected.
Fixes #1014