Lists
Last updated
Last updated
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 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 for more.
If you need animations, then you may consider using dynamic lists or a solution like to "freeze" the state of the outgoing component.
mergeListIds
set to true
in request actions by default?There are a few reasons.
It's nice that all of the mergeX
attributes of the CRUD actions are true
by default.
Multiple requests can contribute to a list. For instance, a user may read a list of
favorites, and then create a new favorite. In this situation, we have multiple requests
contributing to the same list, so it's good that the resources are merged, rather than
replaced.
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 and we'd be happy to discuss it further with you!