Is ListView appropriate for an app with a growing number resources?


#1

ListView seems like the most popular solution for displaying a large number of resources, such as on an index page. As far as I can tell, it works by loading all of the resources into the store, then rendering them a few at a time.

My question is, what if new resources arrive on the server? How would ListView know to target and download them? Take for instance a forum. How would it know there’s a new post? Perhaps, in order to check for new resources, we have to download all the resources over again and let the store sort out which ones are new and which ones are old.

If that’s the case, is this an efficient approach for an app with a large number of resources (1,000+), as it would entail downloading all of those resources every time the client visits the index page. Would a classic infinite scroll be more appropriate in a case like this?

Thanks for your feedback! I like a lot of things about ListView, but as I currently understand it, it doesn’t seem like an appropriate solution for my app.


#2

@timothythehuman as far as I know ( and I don’t have an extensive experience with ListView ) It doesn’t download all of the resources. It asks how many items you have in your store and then loads only the items that the user can see based on the view port size + some more. While you’re scrolling from the once that you know, it will fetch more resources from the source and dump the ones that are no longer viewable.

It can’t know if the source changed, but when it gets a new items for the user, it can get the latest count of the items that are added to the store.

BTW, if you haven’t already seen this, checkout this video on ListView by Erik Bryn


#3

The video isn’t explicit about this one way or the other. The only hint I got was when Erik said that it was expensive to render the big dom, but it wasn’t expensive to load big data. In other words, it was expensive to render a large number of resources, but it wasn’t expensive to download them. I don’t know how this outlook translates to ListView’s actual functionality, though.


#4

I just tweeted Erik… let’s see if he can weigh in on this.


#5

ListView doesn’t concern itself at all with data loading. It just binds to an array. You can choose to manage that array however you wish. Typically if you’re using a data library like Ember Data or Ember Model you’ll end up fetching all of the data and passing it to the ListView for rendering. None of the data libraries currently include support for a sparse array or pagination out of the box.


#6

Thank you Erik for clearing this up.


#7

Thanks, Erik. That helps a lot.


#8

Does anyone have an example of lazily loading (/ load on scroll) with list view + ember data. List view seems great but the lack of concrete examples is putting me off