Remove more unnecessary use of lodash (#1734)

This commit is contained in:
Nathan Bierema 2024-08-30 19:07:05 -04:00 committed by GitHub
parent 238a38fb21
commit b3e8f209fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 12 deletions

View File

@ -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",
@ -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",

View File

@ -1,5 +1,3 @@
import difference from 'lodash/difference';
import omit from 'lodash/omit';
import {
DispatchAction,
InstancesState,
@ -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,

View File

@ -687,9 +687,6 @@ importers:
localforage:
specifier: ^1.10.0
version: 1.10.0
lodash:
specifier: ^4.17.21
version: 4.17.21
react-redux:
specifier: ^9.1.2
version: 9.1.2(@types/react@18.3.4)(react@18.3.1)(redux@5.0.1)
@ -739,9 +736,6 @@ importers:
'@types/json-schema':
specifier: ^7.0.15
version: 7.0.15
'@types/lodash':
specifier: ^4.17.7
version: 4.17.7
'@types/node':
specifier: ^20.16.1
version: 20.16.1