samiskin / redux-electron-store

⎋ A redux store enhancer that allows automatic synchronization between electron processes
MIT License
375 stars 32 forks source link

Doesn't play nice with redux-actions #34

Closed baszalmstra closed 7 years ago

baszalmstra commented 7 years ago

We use redux-actions which has this defined when handling actions:

return (state = defaultState, action) => {
    if (!includes(actionTypes, action.type.toString())) {
      return state;
    }

    return (action.error === true ? throwReducer : nextReducer)(state, action);
  };

This is a problem for redux-electron-store when you do not pass in an initialState because of this line in electronRendererEnhancer.js:

let newInitialState = objectMerge(initialState || reducer(undefined, { type: null }), preload);

The type is set to null which causes an error in redux-actions.

samiskin commented 7 years ago

Hi, thanks for submitting the issue. To confirm, would @@redux/INIT be the correct default type value here? My intention with that line was to create an "initial state" by passing some blank action that would make everything give defaults.

baszalmstra commented 7 years ago

yeah, that sounds good. On Thu, 10 Nov 2016 at 15:20, Shiranka Miskin notifications@github.com wrote:

Hi, thanks for submitting the issue. To confirm, would @@redux/INIT be the correct default type value here? My intention with that line was to create an "initial state" by passing some blank action that would make everything give defaults.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/samiskin/redux-electron-store/issues/34#issuecomment-259701460, or mute the thread https://github.com/notifications/unsubscribe-auth/AEw7f5srSVuEABm2waTLiYBYZ-rtvXUXks5q8yg8gaJpZM4KudFx .

samiskin commented 7 years ago

Should be fixed in v0.4.1