hiebj / stately

elegant, type-safe state management
2 stars 1 forks source link

flip arity of asyncActionMatcher() #8

Closed hiebj closed 5 years ago

hiebj commented 5 years ago
asyncActionMatcher(phase, operation)

would be better if written as

asyncActionMatcher(operation, phase)

It was written the first way because, in the implementation of asyncLifecycle, asyncActionMatcher() is called with no operation (because the operation may be anonymous, and the resulting matcher is verifying uuid as well, which is narrower than matching on operation).

however, end users will very much more frequently be calling asyncActionMatcher() with an operation, but no specific phase - meaning, "match any action dispatched for this operation".

we should be catering to the end user's common use case, not the one internal use case.

hiebj commented 5 years ago

released as stately-async@0.2.10