diff --git a/site/package.json b/site/package.json index 560d5d56a..b18b1f4a0 100644 --- a/site/package.json +++ b/site/package.json @@ -87,7 +87,6 @@ "recharts": "^2.1.8", "reduce-reducers": "^1.0.4", "redux": "^4.0.4", - "reselect": "^4.0.0", "styled-components": "^5.3.1", "whatwg-fetch": "^3.0.0", "yaml": "^1.9.2" diff --git a/site/source/selectors/simulationSelectors.ts b/site/source/selectors/simulationSelectors.ts index 685998545..adbfdae78 100644 --- a/site/source/selectors/simulationSelectors.ts +++ b/site/source/selectors/simulationSelectors.ts @@ -1,11 +1,11 @@ import { DottedName } from 'modele-social' import { RootState, SimulationConfig } from 'Reducers/rootReducer' -import { createSelector } from 'reselect' export const configSelector = (state: RootState): Partial => state.simulation?.config ?? {} -export const objectifsSelector = createSelector([configSelector], (config) => { +export const objectifsSelector = (state: RootState) => { + const config = configSelector(state) const primaryObjectifs = (config.objectifs ?? ([] as any)) .map((obj: DottedName | { objectifs: Array }) => typeof obj === 'string' ? [obj] : obj.objectifs @@ -14,7 +14,7 @@ export const objectifsSelector = createSelector([configSelector], (config) => { const objectifs = [...primaryObjectifs, ...(config['objectifs cachés'] ?? [])] return objectifs -}) +} const emptySituation: Partial< Record> @@ -29,18 +29,18 @@ export const initialSituationSelector = (state: RootState) => export const configSituationSelector = (state: RootState) => configSelector(state).situation ?? emptySituation -export const firstStepCompletedSelector = createSelector( - [situationSelector, configSituationSelector, initialSituationSelector], - (situation, baseSituation, initialSituation) => { - return ( - Object.keys(situation).filter( - (dottedName) => - !Object.keys(baseSituation).includes(dottedName) && - !Object.keys(initialSituation).includes(dottedName) - ).length > 0 - ) - } -) +export const firstStepCompletedSelector = (state: RootState) => { + const situation = situationSelector(state) + const baseSituation = configSituationSelector(state) + const initialSituation = initialSituationSelector(state) + return ( + Object.keys(situation).filter( + (dottedName) => + !Object.keys(baseSituation).includes(dottedName) && + !Object.keys(initialSituation).includes(dottedName) + ).length > 0 + ) +} export const targetUnitSelector = (state: RootState) => state.simulation?.targetUnit ?? '€/mois' diff --git a/yarn.lock b/yarn.lock index 3046c16b8..2e83fe5bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5600,11 +5600,6 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= -reselect@^4.0.0: - version "4.1.5" - resolved "https://registry.yarnpkg.com/reselect/-/reselect-4.1.5.tgz#852c361247198da6756d07d9296c2b51eddb79f6" - integrity sha512-uVdlz8J7OO+ASpBYoz1Zypgx0KasCY20H+N8JD13oUMtPvSHQuscrHop4KbXrbsBcdB9Ds7lVK7eRkBIfO43vQ== - resize-observer-polyfill@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"