I don’t know if this will help you visualize better the state
If you look closely, you will see that almost every item uses the same pattern I mentioned above, current and list.
I know the dox say you can have more than one state, but it seems to me that the whole point of aurelia-store is that everything is stored in one place only.
To give you a specific idea from the state you see in the picture …
- A purchase of goods is made from a supplier
- When the truck arrives at the warehouse an arrival is recorded
- After the goods are inspected (part of the arrival) the warehouse manager moves them into stock.
Say I am on the “arrival page” and I need to display some information about the purchase, - I already have state.purchase (I know an arrival can only come from that purchase). If I need the supplier’s full name, I already have a list of suppliers (supplier.list), so I can do a quick
const name = this.state.supplier.list.find(c=>c.id==this.state.purchase.supplierId).name;
Actually the way I really “learned” about store, was because this was the first app I’ve written that is mobile only - so I have to have the list of items in one view and the details in another view. I’m constantly hopping around between the list and the details. I don’t have the physical space on the screen to show the master/details. It forced me to completely rethink what I was doing - for example sending the supplier’s name as a parameter on the route so I could display it in the arrival view.
I don’t proclaim to be an expert on aurelia-store by any means - you need @zewa666 for that