mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-25 15:40:06 +03:00
Remove lodash from redux-devtools
This commit is contained in:
parent
71b1261757
commit
5f07399f3b
|
@ -42,8 +42,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.25.0",
|
||||
"@redux-devtools/instrument": "^2.2.0",
|
||||
"lodash-es": "^4.17.21"
|
||||
"@redux-devtools/instrument": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.24.8",
|
||||
|
@ -54,7 +53,6 @@
|
|||
"@babel/preset-react": "^7.24.7",
|
||||
"@babel/preset-typescript": "^7.24.7",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^20.14.14",
|
||||
"@types/react": "^18.3.3",
|
||||
"jest": "^29.7.0",
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import { identity, mapValues } from 'lodash-es';
|
||||
import { Action, Reducer, StoreEnhancer } from 'redux';
|
||||
import { LiftedState } from '@redux-devtools/instrument';
|
||||
|
||||
export default function persistState<S, A extends Action<string>, MonitorState>(
|
||||
sessionId?: string | null,
|
||||
deserializeState: (state: S) => S = identity,
|
||||
deserializeAction: (action: A) => A = identity,
|
||||
deserializeState: (state: S) => S = (state) => state,
|
||||
deserializeAction: (action: A) => A = (state) => state,
|
||||
): StoreEnhancer {
|
||||
if (!sessionId) {
|
||||
return (next) =>
|
||||
|
@ -18,10 +17,15 @@ export default function persistState<S, A extends Action<string>, MonitorState>(
|
|||
): LiftedState<S, A, MonitorState> {
|
||||
return {
|
||||
...state,
|
||||
actionsById: mapValues(state.actionsById, (liftedAction) => ({
|
||||
...liftedAction,
|
||||
action: deserializeAction(liftedAction.action),
|
||||
})),
|
||||
actionsById: Object.fromEntries(
|
||||
Object.entries(state.actionsById).map(([actionId, liftedAction]) => [
|
||||
actionId,
|
||||
{
|
||||
...liftedAction,
|
||||
action: deserializeAction(liftedAction.action),
|
||||
},
|
||||
]),
|
||||
),
|
||||
committedState: deserializeState(state.committedState),
|
||||
computedStates: state.computedStates.map((computedState) => ({
|
||||
...computedState,
|
||||
|
|
|
@ -617,9 +617,6 @@ importers:
|
|||
'@redux-devtools/instrument':
|
||||
specifier: ^2.2.0
|
||||
version: link:../redux-devtools-instrument
|
||||
lodash-es:
|
||||
specifier: ^4.17.21
|
||||
version: 4.17.21
|
||||
devDependencies:
|
||||
'@babel/cli':
|
||||
specifier: ^7.24.8
|
||||
|
@ -645,9 +642,6 @@ importers:
|
|||
'@types/jest':
|
||||
specifier: ^29.5.12
|
||||
version: 29.5.12
|
||||
'@types/lodash-es':
|
||||
specifier: ^4.17.12
|
||||
version: 4.17.12
|
||||
'@types/node':
|
||||
specifier: ^20.14.14
|
||||
version: 20.14.14
|
||||
|
|
Loading…
Reference in New Issue
Block a user