Skip to content

Commit

Permalink
front: fix ch suggestions update
Browse files Browse the repository at this point in the history
Signed-off-by: SarahBellaha <[email protected]>
  • Loading branch information
SarahBellaha committed Jan 22, 2025
1 parent ceb2468 commit 025c4e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
Expand Down
4 changes: 2 additions & 2 deletions front/src/reducers/osrdconf/stdcmConf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down

0 comments on commit 025c4e1

Please sign in to comment.