Comment on page
Lists
Redux Resource currently only provides lists as a way to keep track of the initial sort order returned from a single request. As more requests are made against a single list, it will not respect any particular order.
If you'd like to maintain ordering of some kind within a specific list, or all of your lists, then we recommend writing a plugin to handle that.
Yes, they can. Use the
UPDATE_RESOURCES
action type to manage client-side things.In the majority of situations, you won't need to use dynamic lists. For instance, if you are building a banking application that lets a user display transactions for each of their bank accounts, you might think to make a list for each one, like this:
transactionsFor${accountId}
There are situations when this could be useful. For instance, if you wish to display the transactions of many bank accounts onscreen at once. Most applications, though, only let the user see one set of transactions per account at once. Therefore, it's much better to just use a single list.
transactionsForAccount
As the user moves between pages in the application, you can set
mergeListIds
to false
to throw away the previous list, and start fresh.Concerned about caching? That should be handled at the request level instead. Check out the caching recipe for more.
If you need animations, then you may consider using dynamic lists or a solution like freezus to "freeze" the state of the outgoing component.
There are a few reasons.
- 1.It's nice that all of the
mergeX
attributes of the CRUD actions aretrue
by default. - 2.Multiple requests can contribute to a list. For instance, a user may read a list offavorites, and then create a new favorite. In this situation, we have multiple requestscontributing to the same list, so it's good that the resources are merged, rather thanreplaced.
We understand that
mergeListIds
is one of those attributes that you'll frequently be setting to false. We believe the reasons above justify keeping it true
by default, but if you disagree, feel free to open an issue and we'd be happy to discuss it further with you!Last modified 5yr ago