Skip to content

Wrapping reducer in handleAction throws undefined state #23

Closed
@Bartvds

Description

@Bartvds

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions