Skip to content

Commit

Permalink
Remove more unnecessary use of lodash (#1734)
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 authored Aug 30, 2024
1 parent 238a38f commit b3e8f20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 0 additions & 2 deletions packages/redux-devtools-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"@redux-devtools/ui": "^1.3.2",
"localforage": "^1.10.0",
"jsan": "^3.1.14",
"lodash": "^4.17.21",
"react-redux": "^9.1.2",
"redux": "^5.0.1",
"redux-persist": "^6.0.0",
Expand All @@ -62,7 +61,6 @@
"@rjsf/core": "^5.20.0",
"@types/jsan": "^3.1.5",
"@types/json-schema": "^7.0.15",
"@types/lodash": "^4.17.7",
"@types/node": "^20.16.1",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
Expand Down
14 changes: 10 additions & 4 deletions packages/redux-devtools-app/src/utils/monitorActions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import difference from 'lodash/difference';
import omit from 'lodash/omit';
import {
DispatchAction,
InstancesState,
Expand All @@ -11,10 +9,18 @@ import { Dispatch, MiddlewareAPI } from 'redux';
import { StoreActionWithoutLiftedAction } from '../actions';

export function sweep(state: State): State {
const skippedActionIdsSet = new Set(state.skippedActionIds);

return {
...state,
actionsById: omit(state.actionsById, state.skippedActionIds),
stagedActionIds: difference(state.stagedActionIds, state.skippedActionIds),
actionsById: Object.fromEntries(
Object.entries(state.actionsById).filter(
([actionId]) => !skippedActionIdsSet.has(parseInt(actionId, 10)),
),
),
stagedActionIds: state.stagedActionIds.filter(
(actionId) => !skippedActionIdsSet.has(actionId),
),
skippedActionIds: [],
currentStateIndex: Math.min(
state.currentStateIndex,
Expand Down
6 changes: 0 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b3e8f20

Please sign in to comment.