Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Fix($animateCss): should clear cache if element has no animation. #12381

Closed
wants to merge 1 commit into from
Closed

Fix($animateCss): should clear cache if element has no animation. #12381

wants to merge 1 commit into from

Conversation

sreeramu
Copy link
Contributor

We should remove animation cache if the element don't have animation so follow-up animation on the same element will not be from cache.

This PR will close #12214 #12518

@sreeramu sreeramu changed the title Fix($animate): should clear cache if element dont have animation so follow-up animation on the same element will not be from cache Fix($animateCss): should clear cache if element has no animation so follow-up animation on the same element will not be from cache. Jul 20, 2015
@sreeramu sreeramu changed the title Fix($animateCss): should clear cache if element has no animation so follow-up animation on the same element will not be from cache. Fix($animateCss): should clear cache if element has no animation. Jul 23, 2015
@sreeramu
Copy link
Contributor Author

@matsko can you check this PR, is the fix is OK or is it not a issue.?

@matsko
Copy link
Contributor

matsko commented Aug 14, 2015

Hey @sreeramu. Thanks again for putting in work into fixing ngAnimate.

The cache needs to be cleared in the next RAF. The reason for this is if a big list of repeated items attempts to detect an animation then it will only perform the getComputedStyle detection code once. Once things are quiet then it clears the cache. The final code should look like this:

      function closeAndReturnNoopAnimator() {
        runner = new $$AnimateRunner({
          end: endFn,
          cancel: cancelFn
        });

        // this will clear the cache internally
        waitUntilQuiet(noop);
        close();

        return {
          $$willAnimate: false,
          start: function() {
            return runner;
          },
          end: endFn
        };
      }

That one line is all that needs to be changed. Then inside of your test code just add a call to $$rAF.flush() before running the next animation.

…ollow-up animation on the same element will not be from cache.
@sreeramu
Copy link
Contributor Author

Thanks @matsko for explaining the issue clearly, i had updated the PR according to your comments.

@sreeramu sreeramu closed this Aug 15, 2015
@sreeramu sreeramu reopened this Aug 15, 2015
@matsko matsko closed this in 0a75a3d Aug 17, 2015
@matsko
Copy link
Contributor

matsko commented Aug 17, 2015

Landed as 0a75a3d. Thank you @sreeramu.

@sreeramu sreeramu deleted the patch-2 branch August 18, 2015 03:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$animate.enter/leave does not animate properly when animation property is defined by css's descandant selector
3 participants