You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an empty map is passed to handleActions, then Redux is failed because undefined will be returned for undefined state input. This has been already indicated in the discussion of #167 by @geminiyellow. The error message:
Uncaught Error: Reducer "somekeyinsomestateobject" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.
The message comes from Redux, but the problem is caused by implementation of redux-actions' handleActions.
Of course there are not many useful use-cases for an empty map. Reducers of such handleActions basically mean that their associated state elements are unmodifiable, which is not recommended, as far as I know. It can be a "feature", but then the documentation should be updated indicating this mandatory condition.
The text was updated successfully, but these errors were encountered:
ruszki
changed the title
Error when handleActions' map doesn't contain element
Error when handleActions' map doesn't contain entries
Nov 30, 2016
We started to transform our product to a React/Redux based site from a Thymeleaf based one. Now, the server generates an object which is used as an initial state by Redux. So some state elements are not yet under the control of Redux, and thus, they are read-only. We used handleActions({}, defaultState) as a dummy reducer. It was chosen to maintain consistency with other reducers, so it was just a matter of taste.
Hi,
When an empty map is passed to handleActions, then Redux is failed because undefined will be returned for undefined state input. This has been already indicated in the discussion of #167 by @geminiyellow. The error message:
The message comes from Redux, but the problem is caused by implementation of redux-actions' handleActions.
Of course there are not many useful use-cases for an empty map. Reducers of such handleActions basically mean that their associated state elements are unmodifiable, which is not recommended, as far as I know. It can be a "feature", but then the documentation should be updated indicating this mandatory condition.
The text was updated successfully, but these errors were encountered: