You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AnimationFrameScheduler doesn't execute scheduled tasks under certain circumstances.
If AnimationFrameScheduler gets a new id (e.g. new task is scheduled) before the flush method empties current actions array in the do-while loop we encounter wrong behavior.
In this case we enter the recycleAsyncId method of AnimationFrameAction .
Then recycleAsyncId sets _scheduled field to undefined.
After that we add new actions to the actions array in requestAsyncId, start requestAnimationFrame and enter flush method again on browser repaint.
But this time actions array in the flush method has two types of action with different id's.
What is the most important is that the first element of the actions array has id which is different from the current frame id.
This leads us to false condition "action.id === flushId" (in do-while loop) because action.id is the id of the previous frame but flushId is the id of the current frame.
Since that moment we are unable to execute any action in the actions array and empty it.
Problem occured after commit e35f589
in src/internal/scheduler/AnimationFrameAction.ts lines 30-33
Describe the bug
AnimationFrameScheduler doesn't execute scheduled tasks under certain circumstances.
If AnimationFrameScheduler gets a new id (e.g. new task is scheduled) before the flush method empties current actions array in the do-while loop we encounter wrong behavior.
In this case we enter the recycleAsyncId method of AnimationFrameAction .
Then recycleAsyncId sets _scheduled field to undefined.
After that we add new actions to the actions array in requestAsyncId, start requestAnimationFrame and enter flush method again on browser repaint.
But this time actions array in the flush method has two types of action with different id's.
What is the most important is that the first element of the actions array has id which is different from the current frame id.
This leads us to false condition "action.id === flushId" (in do-while loop) because action.id is the id of the previous frame but flushId is the id of the current frame.
Since that moment we are unable to execute any action in the actions array and empty it.
Problem occured after commit e35f589
in src/internal/scheduler/AnimationFrameAction.ts lines 30-33
Expected behavior
Expected console log output:
default task
task1
task2
default task
task1
task2
Reproduction code
Reproduction URL
https://stackblitz.com/edit/1gjlhu?devtoolsheight=50&file=index.ts
Version
7.5.1
Environment
No response
Additional context
animationFrameScheduler from rxjs version 7.1.0 worked correctly in this case
The text was updated successfully, but these errors were encountered: