orizens / ngx-infinite-scroll

Infinite Scroll Directive for Angular
https://www.npmjs.com/package/ngx-infinite-scroll
MIT License
1.25k stars 224 forks source link

console warning "violation 'settimeout' handler took n ms" coming multiple times #434

Open RjunH opened 6 months ago

RjunH commented 6 months ago

Angular Version: 16 "ngx-infinite-scroll": "16.0.0"

<div infiniteScroll [scrollWindow]="false" [infiniteScrollDistance]="1.5" [infiniteScrollThrottle]="250" (scrolled)="loadMoreUsers()" >

Scrolled method loadMoreUsers() is being used to make a API call with pagination on each scroll. Big chunk of data being fetched from the API. APIs response time is within 800ms.

On each scrolled method call, 50+ records are being concatenated to existing array and issue starts after 10-12 times (pages) scroll.

image

Time taken to complete the loadMoreUsers() method is increasing exponentially on each scroll method call. Also as observed execution is getting stalled and console warnings are coming multiples times, saying "violation 'settimeout' handler took n ms"

Also number of setTimout calls getting increased with each scrolled method call.

Any help or direction to resolve this issue would be appreciated.