redux-actions: Wrapping reducer in handleAction throws undefined state

If I wrap a reducer in handleAction I get this error:

“Reducer “selectedReddit” 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.”

If I debug I see redux tries to get a initial state by calling the wrapped reducer with undefined state and a specific system action type. Because the type does not match the wrapped one the inner reducer never runs and no state default is created.

If I use handleActions (m) with default state it works fine. Same function with default state in arguments and classic action-type check is also fine.

Anyway,is handleAction usable like this? Readme doesn’t really specifiy use case.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Thanks for the reminder @yangmillstheory 👍