Skip to content
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

Keeping the ui limited #150

Closed
Jerczu opened this issue Mar 29, 2017 · 8 comments
Closed

Keeping the ui limited #150

Jerczu opened this issue Mar 29, 2017 · 8 comments

Comments

@Jerczu
Copy link
Contributor

Jerczu commented Mar 29, 2017

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

@dhilt
Copy link
Member

dhilt commented Mar 30, 2017

@Jerczu You always can eliminate items via adapter.applyUpdates method. It seems logical to do it manually since you are adding items manually...

@Jerczu
Copy link
Contributor Author

Jerczu commented Mar 30, 2017

@dhilt Thanks for the advice, much appreciated I'll have a go at implementing that and see how well it works.

@mfeingold
Copy link
Contributor

@dhilt do you think it makes sense to apply the same trimming process after manual updates? It should not be too difficult

@dhilt
Copy link
Member

dhilt commented Mar 30, 2017

@mfeingold One more remote-sync demo for applyUpdates? A good idea, I think.

@Jerczu
Copy link
Contributor Author

Jerczu commented Mar 31, 2017

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.

@dhilt
Copy link
Member

dhilt commented Mar 31, 2017

@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.

@Jerczu
Copy link
Contributor Author

Jerczu commented Apr 6, 2017

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.

@dhilt
Copy link
Member

dhilt commented Apr 6, 2017

@Jerczu Btw the described fix will be included in the next (v1.6.2) release and also I have opened a separate issue (#151) for the remain part of the problem, so I'm closing this one. Thanks!

@dhilt dhilt closed this as completed Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants