diff --git a/front/src/applications/stdcm/components/StdcmForm/StdcmOperationalPoint.tsx b/front/src/applications/stdcm/components/StdcmForm/StdcmOperationalPoint.tsx index a1ff6fd1868..94130c48c7c 100644 --- a/front/src/applications/stdcm/components/StdcmForm/StdcmOperationalPoint.tsx +++ b/front/src/applications/stdcm/components/StdcmForm/StdcmOperationalPoint.tsx @@ -145,6 +145,10 @@ const StdcmOperationalPoint = ({ location, pathStepId, disabled }: StdcmOperatio useEffect(() => { if (location) { setSearchTerm(location.name); + // Clear the list of CH suggestions if the location has changed to avoid showing outated suggestions + if (!chSuggestions.some((suggestion) => suggestion.label === location.secondary_code)) { + setChSuggestions([]); + } } else { setSearchTerm(''); setChSuggestions([]); diff --git a/front/src/reducers/osrdconf/stdcmConf/index.ts b/front/src/reducers/osrdconf/stdcmConf/index.ts index e0c8194aac9..c90845754e3 100644 --- a/front/src/reducers/osrdconf/stdcmConf/index.ts +++ b/front/src/reducers/osrdconf/stdcmConf/index.ts @@ -229,10 +229,10 @@ export const stdcmConfSlice = createSlice({ }> ) { const { linkedTrainExtremity, trainName, pathStep, pathStepId } = action.payload; - const { name, ch, uic, geographic, arrivalDate, date, time } = pathStep; + const { name, ch, uic, geographic, arrivalDate, date, time, trigram } = pathStep; const newPathStep = { - location: { name, coordinates: geographic.coordinates, uic, secondary_code: ch }, + location: { name, coordinates: geographic.coordinates, uic, secondary_code: ch, trigram }, id: pathStepId, arrival: arrivalDate, ...(linkedTrainExtremity === 'origin' && { arrivalType: ArrivalTimeTypes.PRECISE_TIME }),