Standardized Actions
As a way of promoting and enforcing standards across our repositories/applications that use redux, we've decided to adopt the flux standard action (FSA) standard for our action objects. The standard is very concise, logical, and easy-to-learn. In addition, there is a flux-standard-action
module published to npm that exposes an isFSA
function for testing whether an object adheres to the standard. The existence of this utility was a big factor in our decision to adopt FSA since a standard that isn't (easily) enforceable isn't much good at all. Accordingly - and as noted in Testing Strategies - we include a test to prove that each action created by our action creators passes isFSA
in our redux unit tests.
There has been some controversy around the way that FSA handles errors, and we at Tidepool agree with @gajus that it would be better to put the Error
object in the error
field of an action, leaving the payload
free to contain other information that might be needed to effect a change in the app's store. (We note this here as a reminder to ourselves to check occasionally to see if the standard has changed...)