briebug / ngrx-auto-entity

NgRx Auto-Entity: Simplifying Reactive State
https://briebug.gitbook.io/ngrx-auto-entity/
Other
66 stars 12 forks source link

Feature: Ability to delete an entity/entities from the store by id. #85

Closed mxdmedia closed 4 years ago

mxdmedia commented 4 years ago

One feature (that seems would be somewhat easy to implement) that would be quite convenient, is the ability to remove entities from the store with only an id. Currently in order to delete an entity or entities, I am doing the following:

  store$.dispatch(new DeleteSuccess(EntityType, entityToDelete));
  // or
  store$.dispatch(new DeleteManySuccess(EntityType, entitiesArray));

However, this requires that I already have the entity or entities I want to delete. My problem there also goes back to my frequent use of child/parent relationships. There are many times I'd like to delete, say, all of the children of a given parent, but in the current view I only have a list of child ids. It would be great to be able to do something like:

  store$.dispatch(new DeleteIdSuccess(EntityType, entityIdToDelete));
  // or
  store$.dispatch(new DeleteManyIdsSuccess(EntityType, entityIdArray));

rather than having to go fetch an entity or entity array in order to remove.

patpaquette commented 4 years ago

Implementation Proposal