Closed Odonno closed 5 years ago
And why not meta collection reducer with:
REQUEST
| SUCCESS
| FAILED
And then provide some meta collection selectors:
areAllEntitiesLoaded
isEntityLoaded
(with key as props)allEntities
(with filter props)entityByKey
(with key as props)What's the difference or the benefits in comparison to ngrx/entity?
It seems I needed to play with ngrx/entity package. I know now how to use it with createAdapter
and getSelectors
function.
Maybe the only missing part would be to have a state/adapter for loadable entities because I believe ngrx/data is too much specialized on this subject.
We often write collection reducers. By collection reducer, I mean pure reducers to add, update or remove an element inside an array.
Source:
Usage:
And we can of course make it even simpler with the feature pattern.
Source:
Usage:
I know there are packages
@ngrx/entity
/@ngrx/data
that deal with that stuff but the goal of this function is to be that simple.If accepted, I would be willing to submit a PR for this feature
[x] Yes (Assistance is provided if you need help submitting a pull request) [ ] No