-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Table: VirtualScroll + Lazy Load incorrectly paginates load requests, displays loadingbody too frequently #11789
Comments
Hi, This is by design, the loading body has to be unique for each user depending on the API and request logic. This is just a dummy example to show what it seems like. You can customize it to your needs. |
Maybe I expressed myself badly, the loading body shows too frequently, in the previous versions I could scroll slowly and smoothly without the list becoming unusable so frequently and making the content disappear. It looks it's showing all elements of the list as loading, while it should show only the actual ones that get loaded at the end of the current view. |
Can you guys please check this? It's blocking the upgrade of our project, and until it gets fixed we have to stay with LTS. Thanks |
I'm sorry for insisting, but can you please reopen the issue? The bug is present, significant, clear and reproducible, and no matter all the research I'm trying to do on your source code, I'm unable to find a cause. Thanks |
No worries! Could you please change numToleratedItems according to your needs? |
It seems that adding the options doesn't change the issue, the table still shows everything as loading in the exact moment it tries to fetch a new chunk. |
I've made for your convenience a stackblitz example here showing now only that the loading body shows whenever the chunk is loaded, but if you check the console, the lazy load requests are strange. For example, I'd expect the list to ask for 0-50, 51-100, 101-150, instead it seems to go wild and asks like 0-48, 5-74, 29-98, 67-136. There's a lot of overlap, the client is basically requesting records it already asked for, and that's wildly inefficient compared to the previous implementation. I presume it might be a possible cause for this glitch, since it asks for rows in the current view. It's perfectly reasonable to build the request size from the height, |
This is also an issue for us also. We are not able to upgrade our project to v14 until this is fixed. |
I'm experiencing a similar issue with the index and chunk size is all over the place. Even with 100 items loaded into the table, the lazy load event gets triggered after scrolling past a low number of rows. This behavior occurs at a variety of scroll heights and other settings. Lazy loading works exactly as expected with pagination, leading me to believe the issue is more related to virtual scroll or the combination of virtual scroll with lazy loading |
I've checked it's definitely related to the combination of virtual scrolling and lazy loading. It doesn't happen in any other case. EDIT: I mistakingly closed the issue |
Same problem here, when you combine virtualScroll and lazy loading the load of pages is all over the place, no matter the configuration of the scroller options. |
We have also encountered this issue indeed. Apart from that, it seems the scroller re-inits when the items change, then triggers a lazy load, that again causes the items to change. Hence, we arrive in some infinite loop of updates. EDIT: //trigger change detection
this.virtualCars = [...this.virtualCars]; and the source code on the same page contains //trigger change detection
event.forceUpdate(); I assume that this has changed then, since the second method does not trigger the infinite update-loop, but the stackblitz has not been updated? By the way, the infinite loop was introduced in d0626b1, since it no longer checks whether the lengths of the previous and current value differ (which indeed wasn't a correct check anyway, but now causes the "old" change detection trigger to trigger a bit more than that). See the stackblitz here for the inifite loop (small adaptation of the one made by @john8329) Sorry to hijack the subject a bit, still curious to see an answer to the original question because that bothers us as well :) Should I make a separate issue out of this? All and all this is preventing us to upgrade to 14. EDIT2: I see the stackblitz on the site still uses PrimeNG 13, so no infinite loop there |
Yes, I think both problems are related, the infinite loop for the update of [value] and the small increments when scrolling, also we had [rows] property in the table, that is completely ignored in the new scroller component. |
Any update from the devs? The issue seems serious and is definitely blocking adoption for several users. Thanks |
Following, we also have troubles with the virtual scroller on lazy mode if we upgrade to version 14.1.2. Currently I'm trying to work around this issue, but when scrolling up after all items were loaded gives some weird behavior. When logging all things happening, I can see that the first and rows property of the lazyLoadEvent aren't what you'd expect. Please provide us with an update. |
Also experienced issue after the update with infinite loop loading when replacing the table data to trigger change detection. ( data = [...data]) I am using [lazy]="true" and [virtualScroll]="true". |
We also have this Issue. Any idea how long till it could be fixed? Does anyone have a temperary workaround that can be used? |
No solutions for now, basically [lazy] + [virtualScroll] is completely broken in last version (v14.1.2). |
@john8329 Can you add the tag If you create a new issue, please add the link in this so we can subscribe to it too. |
I don't think I'm able to add labels, and it's still "under review", so this is being purposefully ignored anyway. I prefer not to open another ticket, to keep the history clear. I believe the best thing to do is to poke @cetincakiroglu and ask kindly if they could take a look and add the tag again. |
Hi all, Sorry for the delayed response! I made some changes to this. The
|
The same issue still exists on latest version, any workaround to it? even if I set the |
Also see #12206 |
I'm also having issues with virtualScoll + lazy loading. In my case, the table will only show a maximum of rows*4. So if rows = 100, it appears to lazy load after I hit 100, but I can only scroll to the 400th row. If I set rows to my data length/4, I can access everything but then the chunk size is so large that it's not really worth it. |
Make sure you create a sparse array for the entire count of the records, then fill that in with the lazy loaded data. this.dataRows = Array(getCount()); lazy... |
This was closed but only the broken loading process was fixed, the main issue where you have a list of unknown amount of items to be loaded page by page as you scroll is still there, a better description of the issue HERE |
@mertsincan perhaps I am missing something but your fix doesn't appear to be working for me. We have been setting I increased the value of |
Describe the bug
This behavior seems a regression from the previous virtualscroll implementation. You can verify in the PrimeNg demo that when scrolling a table with lazy loading and virtual scrolling, the rows very frequently become their loadingbody templates, especially when reaching specific thresholds.
Untitled.mp4
Environment
nil
Reproducer
No response
Angular version
14.1.1
PrimeNG version
14.0.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
14.19.3
Browser(s)
No response
Steps to reproduce the behavior
Please check the video. Scrolling on the simplest table implementation reproduces this issue.
Expected behavior
I'd expect only the newly loaded rows to behave like that, and to load them before they appear in the view for a better user experience. With a normal implementation like this, the user would see the table very frequently reload its rows, which is unacceptable.
The text was updated successfully, but these errors were encountered: