feat: recalcule la RGCP lorsque la situation change

pull/3197/head
Alice Dahan 2024-10-15 16:40:00 +02:00 committed by liliced
parent 1cf26edea4
commit 7095e3ea40
1 changed files with 9 additions and 0 deletions

View File

@ -17,12 +17,14 @@ import { Message } from '@/design-system'
import { Spacing } from '@/design-system/layout'
import { Li, Ul } from '@/design-system/typography/list'
import { Body } from '@/design-system/typography/paragraphs'
import { situationSelector } from '@/store/selectors/simulationSelectors'
import EffectifSwitch from './components/EffectifSwitch'
import RéductionGénéraleMoisParMois from './RéductionGénéraleMoisParMois'
import {
getInitialRéductionGénéraleMoisParMois,
MonthState,
reevaluateRéductionGénéraleMoisParMois,
rémunérationBruteDottedName,
} from './utils'
@ -105,6 +107,13 @@ function RéductionGénéraleSimulationGoals({
réductionGénéraleMoisParMoisData,
])
const situation = useSelector(situationSelector)
useEffect(() => {
setData((previousData) =>
reevaluateRéductionGénéraleMoisParMois(previousData, engine)
)
}, [engine, situation])
return (
<SimulationGoals toggles={toggles} legend={legend}>
{monthByMonth ? (