briebug / ngrx-auto-entity

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

fix/nae-115/failure action response #121

Closed schuchard closed 4 years ago

schuchard commented 4 years ago

fixes #115

jrista commented 4 years ago

Lets squash all the commits for this into one, with a proper commit message as described last night:

feat|fix|refactor: <message>

 + Additions
 - Removals
 * Other stuff

<related issues>
schuchard commented 4 years ago

ready to go @jrista

schuchard commented 4 years ago

What do you think about extending this pattern to the Load* actions and expose the following?

Another question, should we also be passing the criteria in the failure cases as well? There could be identifying information in there as well, but this could be in a later PR?

schuchard commented 4 years ago

Just realized the types are not accurate for the action. entity, entities, key, and keys are not coming through no the action type. Need to make a few more changes.

schuchard commented 4 years ago

false alarm, it turns out we need to explicitly type the action to pickup the properties.

ofEntityType<Customer, CreateFailure<Customer>>
jrista commented 4 years ago

What do you think about extending this pattern to the Load* actions and expose the following?

  • LoadFailure - key
  • LoadManyFailure, LoadAllFailure - criteria
  • LoadPageFailure - page
  • LoadRangeFailure - range

Another question, should we also be passing the criteria in the failure cases as well? There could be identifying information in there as well, but this could be in a later PR?

Yeah, there is no reason we can't thread all the relevant information through the entire chain of actions.

We might as well go ahead and do that. One of the other stories is also to expand our action patterns from a two-stage to a three-stage patern. From Initiaor -> Result to Initiator -> Response -> Result. I guess it is up to you whether you want to make the changes you recommended here, or maybe wait for the three-stage pattern story, and make them when we make that change?