2.5.0
2.5.0 - 2017-08-21
## Redux
- Breaking change - reducers should no longer be registered as
{ state, reducer}. Instead, the format is:
// root key name, reducer function, and initial state (as a plain object)
config.addReducer('keyName', reducerFunction, { count: 0 });-
Initial state should now be a plain object; it will be wrapped in a call to
seamless-immutableautomatically, providing immutability by default -
Refactors
kit/lib/redux.js -> unwind()to wrap custom reducers in adefaultReducerfunction, that detects a Redux undefined sentinelstateand returns a plain object -- otherwise, calls the 'real' reducer. (The side-effect to this is that reducer no longer need to handle undefined values!)
GraphQL
- Adds optional middleware / afterware to Apollo client instantiation via:
config.addApolloMiddleware()config.addApolloAfterware()
Both functions can be called isomorphically; the middleware will be attached only to the environment in which it's called, so wrap in anif (SERVER)...block if you need to isolate this behaviour. Note: If you're using a built-in GraphQL server, ReactQL will use apollo-local-query instead of regular HTTP requests so middleware won't be executed -- be aware of this if you're doing HTTP header authentication!
Config
- Refactors the
Configclass to progressively add server-side config functions by moving the class into sub-classes for the browser/server