mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 00:19:55 +03:00
Import individual lodash functions
This commit is contained in:
parent
5d6c81aefc
commit
3ed8c11b75
|
@ -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 { Action, PreloadedState, Reducer, StoreEnhancer } from 'redux';
|
||||||
import { LiftedState } from '@redux-devtools/instrument';
|
import { LiftedState } from '@redux-devtools/instrument';
|
||||||
|
|
||||||
|
@ -8,8 +9,8 @@ export default function persistState<
|
||||||
MonitorState
|
MonitorState
|
||||||
>(
|
>(
|
||||||
sessionId?: string | null,
|
sessionId?: string | null,
|
||||||
deserializeState: (state: S) => S = _.identity,
|
deserializeState: (state: S) => S = identity,
|
||||||
deserializeAction: (action: A) => A = _.identity
|
deserializeAction: (action: A) => A = identity
|
||||||
): StoreEnhancer {
|
): StoreEnhancer {
|
||||||
if (!sessionId) {
|
if (!sessionId) {
|
||||||
return (next) =>
|
return (next) =>
|
||||||
|
@ -22,7 +23,7 @@ export default function persistState<
|
||||||
): LiftedState<S, A, MonitorState> {
|
): LiftedState<S, A, MonitorState> {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
actionsById: _.mapValues(state.actionsById, (liftedAction) => ({
|
actionsById: mapValues(state.actionsById, (liftedAction) => ({
|
||||||
...liftedAction,
|
...liftedAction,
|
||||||
action: deserializeAction(liftedAction.action),
|
action: deserializeAction(liftedAction.action),
|
||||||
})),
|
})),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user