} else if (action.type === REHYDRATE) {
// noop on restState if purging
if (_purge)
return {
...restState,
_persist: { ..._persist, rehydrated: true },
}
// @NOTE if key does not match, will continue to default else below
if (action.key === config.key) {
let reducedState = baseReducer(restState, action)
let inboundState = action.payload
// only reconcile state if stateReconciler and inboundState are both defined
let reconciledRest: State =
stateReconciler !== false && inboundState !== undefined
? stateReconciler(inboundState, state, reducedState, config)
: reducedState
let newState = {
...reconciledRest,
_persist: { ..._persist, rehydrated: true },
}
return conditionalUpdate(newState)
}
Created
April 18, 2021 08:33
-
-
Save qkreltms/ad7991302eaf5fc55502c086875a0d1a to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment