-
Notifications
You must be signed in to change notification settings - Fork 12
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
Update virtualScroll.component.ts #6
Conversation
Hi Dinony, We experience poor scrolling performance in IE even if we set vsDebounceTime to a large value. After some investigation we have discovered that Angular change detection is triggered on each 'scroll' event despite debounceTime(). This can be prevented by wrapping Observable.fromEvent(..., 'scroll') in zone.runOutsideAngular(). I couldn't figure out how to create a cold observable with Observable.fromEvent as if subscribe() is called outside of zone.runOutsideAngular() Angular change detection is still triggered on each scroll event. The proposed solution adds an intermediate scroll$ Subject. Kind regards, Serguei.
Hi Serguei, strange, can you tell me, which IE version you are using? |
I’m using IE11, v.11.0.10240.17354, but it doesn’t really matter. Angular change detection is triggered on each scroll event in all browsers. It’s just the performance degradation is more noticeable in IE in our case (depends on the complexity of the UI to be updated, of course).
|
Ok, thanks! On the component level I'm using |
It’s when I’m using it in my application indeed. To be clear, the delays don’t come from the component but from the hosting application.
I think most applications will use Default rather than OnPush most of the time, so it’s best if virtualscroll limits the number of times it triggers Angular change detection.
|
We experience the same problem as well. Change detection is triggered for entire page from top to bottom on every scroll event. For big pages performance degradation is very noticeable, especially in browsers with slow Javascript engines. Is there a need to actually trigger change detection for scroll event? |
Hi @BogdanPolitaiev. Thanks, yep it's planned that I will look into this issue in September - I'm already late though, but it will happen! |
Thanks for the help and for your patience! Changes will be in the next release. |
Hi Dinony,
We experience poor scrolling performance in IE even if we set vsDebounceTime to a large value. After some investigation we have discovered that Angular change detection is triggered on each 'scroll' event despite debounceTime(). This can be prevented by wrapping Observable.fromEvent(..., 'scroll') in zone.runOutsideAngular().
I couldn't figure out how to create a cold observable with Observable.fromEvent as if subscribe() is called outside of zone.runOutsideAngular() Angular change detection is still triggered on each scroll event. The proposed solution adds an intermediate scroll$ Subject.
Kind regards,
Serguei.