The reducer generated by plainMultireducer starts by applying an empty action ({}) to the decorated reducers, to let them generate the initial values.
This empty action, having no 'type', is not FSA-compliant, and happens to break with reducers created with redux-actions's handleActions() :
import { createStore } from 'redux'
import { handleActions } from 'redux-actions';
import multireducer from 'multireducer';
const list = handleActions({
INCREMENT: (state, action) => ({
counter: state.counter + action.payload
}),
DECREMENT: (state, action) => ({
counter: state.counter - action.payload
})
}, { counter: 0 });
const reducer = multireducer({
a: list,
b: list
});
const store = createStore(reducer);
breaks with "Cannot read property 'toSring' of undefined" when the reducer generated by handleActions() tries to run action.type.toString() when action === {}.
That .toString() call was added in the latest v0.12.0 of react-actions, to support a advanced/edge use case - see https://github.com/acdlite/redux-actions/pull/113.
Arguably it's a bit cavalier for an FSA library to internally use "action.type as an object with a toString() method" :-)
Still, using an empty action with no type to bootstrap the reducer seems somewhat wrong ? Why not do like redux does with its '@@redux/INIT' action type ?
The reducer generated by plainMultireducer starts by applying an empty action (
{}
) to the decorated reducers, to let them generate the initial values.This empty action, having no 'type', is not FSA-compliant, and happens to break with reducers created with redux-actions's handleActions() :
breaks with "Cannot read property 'toSring' of undefined" when the reducer generated by handleActions() tries to run action.type.toString() when action === {}.
That .toString() call was added in the latest v0.12.0 of react-actions, to support a advanced/edge use case - see https://github.com/acdlite/redux-actions/pull/113. Arguably it's a bit cavalier for an FSA library to internally use "action.type as an object with a toString() method" :-)
Still, using an empty action with no type to bootstrap the reducer seems somewhat wrong ? Why not do like redux does with its '@@redux/INIT' action type ?