Skip to content

Investigate supporting combineSlices natively in configureStore #4039

Open
@EskiMojo14

Description

@EskiMojo14

combineSlices makes it very convenient to just do combineSlices(sliceA, sliceB), because it automatically mounts slices under their reducerPath. It would be very convenient to also be able to do something like configureStore({ reducer: [sliceA, sliceB] }) and let configureStore call combineSlices automatically.

It's worth noting that combineSlices supercedes combineReducers meaning that where configureStore currently calls combineReducers could be replaced with combineSlices. (this would also support doing configureStore({ reducer: fooSlice }) but I don't know if we want to support that types-wise)

let reducer: Reducer<S, A>;
if (typeof options.reducer === "object") {
  reducer = Array.isArray(options.reducer) ? combineSlices(...options.reducer) : combineSlices(options.reducer)
} else {
  reducer = options.reducer
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions