mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-26 07:59:48 +03:00
Remove lodash from instrument
This commit is contained in:
parent
118a9fb1fa
commit
71b1261757
|
@ -40,10 +40,6 @@
|
||||||
"prepack": "pnpm run clean && pnpm run build",
|
"prepack": "pnpm run clean && pnpm run build",
|
||||||
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
|
||||||
"@babel/runtime": "^7.25.0",
|
|
||||||
"lodash-es": "^4.17.21"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.24.8",
|
"@babel/cli": "^7.24.8",
|
||||||
"@babel/core": "^7.25.2",
|
"@babel/core": "^7.25.2",
|
||||||
|
@ -52,7 +48,6 @@
|
||||||
"@babel/preset-env": "^7.25.3",
|
"@babel/preset-env": "^7.25.3",
|
||||||
"@babel/preset-typescript": "^7.24.7",
|
"@babel/preset-typescript": "^7.24.7",
|
||||||
"@types/jest": "^29.5.12",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/lodash-es": "^4.17.12",
|
|
||||||
"@types/node": "^20.14.14",
|
"@types/node": "^20.14.14",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"redux": "^5.0.1",
|
"redux": "^5.0.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { difference, isPlainObject, union } from 'lodash-es';
|
|
||||||
import {
|
import {
|
||||||
Action,
|
Action,
|
||||||
|
isPlainObject,
|
||||||
Observer,
|
Observer,
|
||||||
Reducer,
|
Reducer,
|
||||||
Store,
|
Store,
|
||||||
|
@ -667,9 +667,18 @@ function liftReducerWith<
|
||||||
const actionIds = [];
|
const actionIds = [];
|
||||||
for (let i = start; i < end; i++) actionIds.push(i);
|
for (let i = start; i < end; i++) actionIds.push(i);
|
||||||
if (active) {
|
if (active) {
|
||||||
skippedActionIds = difference(skippedActionIds, actionIds);
|
const actionIdsSet = new Set(actionIds);
|
||||||
|
skippedActionIds = skippedActionIds.filter(
|
||||||
|
(actionId) => !actionIdsSet.has(actionId),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
skippedActionIds = union(skippedActionIds, actionIds);
|
const skippedActionIdsSet = new Set(skippedActionIds);
|
||||||
|
skippedActionIds = [
|
||||||
|
...skippedActionIds,
|
||||||
|
...actionIds.filter(
|
||||||
|
(actionId) => !skippedActionIdsSet.has(actionId),
|
||||||
|
),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optimization: we know history before this action hasn't changed
|
// Optimization: we know history before this action hasn't changed
|
||||||
|
@ -694,7 +703,10 @@ function liftReducerWith<
|
||||||
}
|
}
|
||||||
case ActionTypes.SWEEP: {
|
case ActionTypes.SWEEP: {
|
||||||
// Forget any actions that are currently being skipped.
|
// Forget any actions that are currently being skipped.
|
||||||
stagedActionIds = difference(stagedActionIds, skippedActionIds);
|
const skippedActionIdsSet = new Set(skippedActionIds);
|
||||||
|
stagedActionIds = stagedActionIds.filter(
|
||||||
|
(actionId) => !skippedActionIdsSet.has(actionId),
|
||||||
|
);
|
||||||
skippedActionIds = [];
|
skippedActionIds = [];
|
||||||
currentStateIndex = Math.min(
|
currentStateIndex = Math.min(
|
||||||
currentStateIndex,
|
currentStateIndex,
|
||||||
|
|
|
@ -15,7 +15,6 @@ import {
|
||||||
LiftedState,
|
LiftedState,
|
||||||
} from '../src/instrument';
|
} from '../src/instrument';
|
||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
import _ from 'lodash';
|
|
||||||
|
|
||||||
type CounterAction = { type: 'INCREMENT' } | { type: 'DECREMENT' };
|
type CounterAction = { type: 'INCREMENT' } | { type: 'DECREMENT' };
|
||||||
function counter(state = 0, action: CounterAction) {
|
function counter(state = 0, action: CounterAction) {
|
||||||
|
@ -1171,13 +1170,15 @@ describe('instrument', () => {
|
||||||
function filterStackAndTimestamps<S, A extends Action<string>>(
|
function filterStackAndTimestamps<S, A extends Action<string>>(
|
||||||
state: LiftedState<S, A, null>,
|
state: LiftedState<S, A, null>,
|
||||||
) {
|
) {
|
||||||
state.actionsById = _.mapValues(state.actionsById, (action) => {
|
state.actionsById = Object.fromEntries(
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
Object.entries(state.actionsById).map(([actionId, action]) => {
|
||||||
// @ts-ignore
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
delete action.timestamp;
|
// @ts-ignore
|
||||||
delete action.stack;
|
delete action.timestamp;
|
||||||
return action;
|
delete action.stack;
|
||||||
});
|
return [actionId, action];
|
||||||
|
}),
|
||||||
|
);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1819,13 +1819,6 @@ importers:
|
||||||
version: 5.0.4(webpack-cli@5.1.4)(webpack@5.93.0)
|
version: 5.0.4(webpack-cli@5.1.4)(webpack@5.93.0)
|
||||||
|
|
||||||
packages/redux-devtools-instrument:
|
packages/redux-devtools-instrument:
|
||||||
dependencies:
|
|
||||||
'@babel/runtime':
|
|
||||||
specifier: ^7.25.0
|
|
||||||
version: 7.25.0
|
|
||||||
lodash-es:
|
|
||||||
specifier: ^4.17.21
|
|
||||||
version: 4.17.21
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@babel/cli':
|
'@babel/cli':
|
||||||
specifier: ^7.24.8
|
specifier: ^7.24.8
|
||||||
|
@ -1848,9 +1841,6 @@ importers:
|
||||||
'@types/jest':
|
'@types/jest':
|
||||||
specifier: ^29.5.12
|
specifier: ^29.5.12
|
||||||
version: 29.5.12
|
version: 29.5.12
|
||||||
'@types/lodash-es':
|
|
||||||
specifier: ^4.17.12
|
|
||||||
version: 4.17.12
|
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^20.14.14
|
specifier: ^20.14.14
|
||||||
version: 20.14.14
|
version: 20.14.14
|
||||||
|
|
Loading…
Reference in New Issue
Block a user