You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
690 B
26 lines
690 B
2 years ago
|
// @flow
|
||
|
|
||
|
import { combineReducers } from 'redux'
|
||
|
import persistReducer from './persistReducer'
|
||
|
import autoMergeLevel2 from './stateReconciler/autoMergeLevel2'
|
||
|
|
||
|
import type { PersistConfig } from './types'
|
||
|
|
||
|
type Reducers = {
|
||
|
[key: string]: Function,
|
||
|
}
|
||
|
|
||
|
type Reducer = (state: Object, action: Object) => Object
|
||
|
|
||
|
// combineReducers + persistReducer with stateReconciler defaulted to autoMergeLevel2
|
||
|
export default function persistCombineReducers(
|
||
|
config: PersistConfig,
|
||
|
reducers: Reducers
|
||
|
): Reducer {
|
||
|
config.stateReconciler =
|
||
|
config.stateReconciler === undefined
|
||
|
? autoMergeLevel2
|
||
|
: config.stateReconciler
|
||
|
return persistReducer(config, combineReducers(reducers))
|
||
|
}
|