diff --git a/site/source/components/utils/EngineContext.tsx b/site/source/components/utils/EngineContext.tsx index 3b5e679cb..b2604a7d2 100644 --- a/site/source/components/utils/EngineContext.tsx +++ b/site/source/components/utils/EngineContext.tsx @@ -12,9 +12,9 @@ import { useDispatch, useSelector } from 'react-redux' import { deleteFromSituation } from '@/store/actions/actions' import { companySituationSelector, + completeSituationSelector, configObjectifsSelector, configSituationSelector, - rawSituationSelector, situationSelector, } from '@/store/selectors/simulationSelectors' import { omit } from '@/utils' @@ -80,7 +80,7 @@ export function useEngine() { return useContext(EngineContext) as Engine } -export const useRawSituation = () => useSelector(rawSituationSelector) +export const useRawSituation = () => useSelector(completeSituationSelector) /** * Try to set situation and delete all rules with syntax/evaluation error diff --git a/site/source/store/middlewares/prendLaProchaineQuestion.middleware.ts b/site/source/store/middlewares/prendLaProchaineQuestion.middleware.ts index 3f3fb0dc4..d31ee38ec 100644 --- a/site/source/store/middlewares/prendLaProchaineQuestion.middleware.ts +++ b/site/source/store/middlewares/prendLaProchaineQuestion.middleware.ts @@ -17,7 +17,7 @@ import { } from '@/store/reducers/rootReducer' import { Simulation } from '@/store/reducers/simulation.reducer' import { - rawSituationSelector, + completeSituationSelector, rawSituationsSelonContextesSelector, } from '@/store/selectors/simulationSelectors' import { complement } from '@/utils/complement' @@ -38,7 +38,7 @@ export const prendLaProchaineQuestionMiddleware = const simulation = newState.simulation const config = simulation?.config - const situation = rawSituationSelector(newState) + const situation = completeSituationSelector(newState) const questionsRépondues = simulation?.answeredQuestions const questionsSuivantesActuelles = simulation?.questionsSuivantes || [] diff --git a/site/source/store/selectors/simulationSelectors.ts b/site/source/store/selectors/simulationSelectors.ts index 60676cb6c..d9c051677 100644 --- a/site/source/store/selectors/simulationSelectors.ts +++ b/site/source/store/selectors/simulationSelectors.ts @@ -1,9 +1,9 @@ +import { NonEmptyArray } from 'effect/Array' import { createSelector } from 'reselect' import { isComparateurConfig } from '@/domaine/ComparateurConfig' import { RootState, Situation } from '@/store/reducers/rootReducer' import { configSelector } from '@/store/selectors/config.selector' -import { NonEmptyArray } from 'effect/Array' export const configObjectifsSelector = createSelector( [ @@ -32,7 +32,7 @@ export const configContextesSelector = createSelector( export const companySituationSelector = (state: RootState) => state.companySituation -export const rawSituationSelector = createSelector( +export const completeSituationSelector = createSelector( [situationSelector, configSituationSelector, companySituationSelector], (simulatorSituation, configSituation, companySituation) => ({ ...companySituation, @@ -42,7 +42,7 @@ export const rawSituationSelector = createSelector( ) export const rawSituationsSelonContextesSelector = createSelector( - [rawSituationSelector, configContextesSelector], + [completeSituationSelector, configContextesSelector], (rawSituation, contextes) => (contextes ? contextes.map((contexte) => ({