ember.jsember-data

Ember Data: When do I use findAll() over query()?


This is the pattern I find myself running into:

I start making an app, and I use findAll() to get a list of [something random].

Once the app is being tested with serious data, the number of random resource instances will grow. I need to limit the number of resource instances on screen. I need to start paginating them. For this I need query string support. E.g. page[offset].

So findAll(criteria) is replaced by query(criteria, querystring).

This is a pattern so much that findAll() is starting to look like a development placeholder for query() to be used later.

I'm probably misunderstanding the use for findAll(). Is it true findAll() cannot use pagination at all (without customizing adapter code)? Can someone explain in what cases findAll() should be used?


Solution

  • I personally use the findAll method for fetching data that appears in various drop-downs and short lists that cannot be filtered by the user. I use query and queryRecord for pretty much everything else.

    Here are a couple of particularities of findAll that can be misleading: