Import individual lodash functions

This commit is contained in:
Nathan Bierema 2022-01-19 11:47:50 -05:00
parent 5d6c81aefc
commit 3ed8c11b75

View File

@ -1,4 +1,5 @@
import _ from 'lodash';
import mapValues from 'lodash/mapValues';
import identity from 'lodash/identity';
import { Action, PreloadedState, Reducer, StoreEnhancer } from 'redux';
import { LiftedState } from '@redux-devtools/instrument';
@ -8,8 +9,8 @@ export default function persistState<
MonitorState
>(
sessionId?: string | null,
deserializeState: (state: S) => S = _.identity,
deserializeAction: (action: A) => A = _.identity
deserializeState: (state: S) => S = identity,
deserializeAction: (action: A) => A = identity
): StoreEnhancer {
if (!sessionId) {
return (next) =>
@ -22,7 +23,7 @@ export default function persistState<
): LiftedState<S, A, MonitorState> {
return {
...state,
actionsById: _.mapValues(state.actionsById, (liftedAction) => ({
actionsById: mapValues(state.actionsById, (liftedAction) => ({
...liftedAction,
action: deserializeAction(liftedAction.action),
})),