1.2.0rc2 : ngRepeat sometimes laggy with adding/removing elements with no animations/transitions #4174
Description
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.