Data stores
- Domain Stores
- Editor Stores
- Active Items Stores
- Master Editor Stores - init(), isDataReady(), commit()
| one store per domain | http call | data loading | isDataReady() | |
|---|---|---|---|---|
| Domain store | yes | yes | app starts | used by master store |
| Editor store | yes | no | by master | used by master store |
| Active items store | yes | no | by master | used by master store |
| Master editor store | no | yes | editor launched | used by component |
Map vs List (which type is better to be used for stores)
| Map with id as key | List | |
|---|---|---|
| find by ID | map.get('' + id) | R.find(R.propEq('id', 123), data) |
| add | map.put('' + id, value) | Need to make sure ID unique |
| remove | map.delete('' + id) | find index, remove |
| update | map.put('' + id, value) | find index, update with index |
| sort (or call .toArray() and use Ramda) | map.toOrderedMap().sortBy(fn) | sortBy(fn) |