Keeping the ui limited
Jerczu opened this issue · comments
So I've noticed if I don't scroll but just keep appending via adapter the adapter seem to ignore the buffer size lets say its 50 you would expect 50 is the limit of the ui in the view but it looks like if I keep appending/prepending those elements are added to UI but none of existing ones removed. Any methods to alleviate that without reloading the whole data source?
You can replicate that in this demo by spamming the prepend button - https://rawgit.com/angular-ui/ui-scroll/master/demo/append/append.html
@Jerczu You always can eliminate items via adapter.applyUpdates method. It seems logical to do it manually since you are adding items manually...
@dhilt Thanks for the advice, much appreciated I'll have a go at implementing that and see how well it works.
@dhilt do you think it makes sense to apply the same trimming process after manual updates? It should not be too difficult
@mfeingold One more remote-sync demo for applyUpdates? A good idea, I think.
Yeah I tried to trim the dataset manually using the applyUpdates() and while it works pagination seem to get broken I'm ending up with a huge whitespace in between pages. I might be doing something wrong but I thought if I return [] the adapter is going to remove the item from the ui and update the pointers not sure what is happening over there.
@Jerczu I have solved your task, please look at https://rawgit.com/angular-ui/ui-scroll/master/demo/adapterSync/adapterSync.html. This also has required some changes in the ui-scroll source code. I would even say that it was uncovered use case, a bug...
There is another problem, I see. When you remove almost all available items and both of EOF and BOF are reached, then the process of items clipping/fetching can not be started -- you may append/prepend unlimited number of items and none of them will be clipped from the viewport.
I have solved your task
Brilliant thank you that helps a lot!
When you remove almost all available items and both of EOF and BOF are reached, then the process of items clipping/fetching can not be started -- you may append/prepend unlimited number of items and none of them will be clipped from the viewport.
Yes that was what I was referring to essentially you can end up with a very long list of elements that can pollute the total watchers amount leading to poorly performing or in some cases I experienced unresponsive ui. This is actually fixed by scrolling those elements trim ok on scroll but if you keep appending / prepending elements they aren't removed from the viewport as you said.