fix: delay use transition #1791
Merged
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.
Why
Summary of Issue
delays are attached in the scheduleProps function where we make our paused, resume queues because scheduleProps is called in a raf loop. But the specific call to scheduleProps is from a SpringValue so that classes' _state has the information that we're actually paused and waiting for something (the delay).
However, the Controller's state doesnt have the information that it's springs are paused (this is the problem // bug) so when when we call onResolve in the useTransition hook the Controller is seen as idle, it's then removed and forceUpdate is called thus cleaning out the transitions array removing the item.
This wouldn't happen normally because the state update would cause the springs to begin animating thus the Controller would not be idle.
What
Added the
isDelayed
prop toSpringValue
so that aController
when checking if it's (theController
)idle
will now check that its springs are not delayed. This therefore does not remove the item and theleave
animation phase can run.Checklist