Closed mecsco closed 6 years ago
For removing child entities, the RemoveData
action can take a map of schema keys mapped to property names for entities which should be removed along with the 'parent' entity. Of course this should only be used for 1:1 relations. To remove an entity completely, you might dispatch a SetData
action with an empty Array.
Ah understood - I think SetData should cover my scenario, I'll close this ticket
Following on from #26 which mentions @ngrx/entity (https://github.com/ngrx/platform/blob/master/docs/entity/adapter.md) and its support for updating partial data, it may also be useful to have the equivalent of its 'removeAll' action so that all the normalized entities can be cleared out without needing to call RemoveData multiple times with all the individual IDs
I suppose different users might have different requirements - for some it could be to empty everything, for others it could be to specify a certain key and only empty that and all its children (although in that case I guess it could get a bit messy if the children were shared with other parent entities that had a different key that weren't being cleared).