Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [ROKU-1647] Animation does not work when called in the callback #20

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

bchelkowski
Copy link
Member

What did you implement:

Closes #19

The behavior of the animate function should now be handled properly and it should be possible to call new animations when the previous one was resolved or rejected.

However, I don't fully understand why aborted animation is rejected and handled like an error, but I didn't change this behavior to not break anything in case of someone already handling it this way and to not introduce a breaking change.

How did you implement it:

AnimatorCore.animate before clearing up the previous animation context checks if the previous promise was resolved.
If yes, then it queues the next animation instead of replacing the old one.

How can we verify it:

Given there is a component with an id container the following code:

    m.container.opacity = 1.0

    ' Immediate calls
    Animator().fadeOut(m.container, { duration: 2 }).finally(sub (state as String)
      ?"Faded Out - ";state
    end sub)
    Animator().fadeIn(m.container, { duration: 2 }).finally(sub (state as String)
      ?"Faded In - ";state
    end sub)
    Animator().fadeOut(m.container, { duration: 2 }).finally(sub (state as String, m as Object)
      ?"Again Faded Out - ";state
      ' Callback calls
      Animator().fadeIn(m.container, { duration: 2 }).finally(sub (state as String, m as Object)
        ?"Again Faded In - ";state
        Animator().fadeOut(m.container, { duration: 2 }).finally(sub (state as String, m as Object)
          ?"And Again Faded Out - ";state
          Animator().fadeIn(m.container, { duration: 2 }).finally(sub (state as String)
            ?"And Again Faded In - ";state
          end sub)
        end sub, m)
      end sub, m)
    end sub, m)

should log the following steps:

Faded Out - aborted
Faded In - aborted
Again Faded Out - stopped
Again Faded In - stopped
And Again Faded Out - stopped
And Again Faded In - stopped

And all animations should behave accordingly, so 2 first will be aborted, and the next 4 should proceed in proper order.

Todos:

  • Write documentation (if required)
  • Fix linting errors
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@bchelkowski bchelkowski requested a review from a team as a code owner April 6, 2023 13:53
@bchelkowski bchelkowski requested review from enzuguri and kuldeepk-dazn and removed request for a team April 6, 2023 13:53
@bchelkowski bchelkowski merged commit 3d06d0d into master Apr 12, 2023
@bchelkowski bchelkowski deleted the ROKU-1647 branch April 12, 2023 12:25
github-actions bot pushed a commit that referenced this pull request Apr 12, 2023
## [2.3.1](v2.3.0...v2.3.1) (2023-04-12)

### Bug Fixes

* [ROKU-1647] Animation does not work when called in the callback ([#20](#20)) ([3d06d0d](3d06d0d))
@github-actions
Copy link

🎉 This PR is included in version 2.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promise Error with Animation Utility
2 participants