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

1.2.0rc2 : ngRepeat sometimes laggy with adding/removing elements with no animations/transitions #4174

Closed
ryanzec opened this issue Sep 26, 2013 · 1 comment

Comments

@ryanzec
Copy link

ryanzec commented Sep 26, 2013

This is something that might or might not be related to #3587.

Basically I have a ngRepeat that has no animations on it however sometimes when the data for the ngRepeat changes, some of the old data is visible for a brief moment. From what I can tell, I think this has to do with the fact that the startAnimation function in the ngAnimate module is doing this:

$timeout(done, duration * 1000, false);

If the element has no animation then duration equals 0 however using $timeout() to call done seems like it can delay the removal of the element just enough so that it still appears when it should not (my understanding is that you use $timeout with 0 to have something happen when in the next digest cycle). When I change that line to this:

if(duration > 0) {
  $timeout(done, duration * 1000, false);
} else {
  done();
}

I can't get the issue to happen. Logically this make sense to me but mind you I am not all the familiar with the internals of the animation system. I think this code makes sure that the done callback is called within the context of the current digest which should make sure the element is remove at the proper time.

This also might be somewhat related to the performance issues I am hearing about with performAnimation() but even if it is, this still seems like something that needs to be fixed.

Is this an actually issue and if so is my code change a valid way to fix it (it does fix the issue but I am not sure if it would break something else)?

Creating a plunker example is going to be difficult because it works in simple application example because it is not doing a lot and the application that does show this issue is something I can't share publicly.

@ghost ghost assigned matsko Sep 26, 2013
@ryanzec
Copy link
Author

ryanzec commented Sep 30, 2013

This was my mistake. I though I was using rc2 but apparently the code was rc1. I have updated to rc2 and that code does have a fix for this issue.

@ryanzec ryanzec closed this as completed Sep 30, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants