diff --git a/front/src/reducers/osrdconf/helpers.ts b/front/src/reducers/osrdconf/helpers.ts index 5cb963c4097..d9285da2d26 100644 --- a/front/src/reducers/osrdconf/helpers.ts +++ b/front/src/reducers/osrdconf/helpers.ts @@ -4,6 +4,7 @@ import { v4 as uuidV4 } from 'uuid'; import { calculateDistanceAlongTrack } from 'applications/editor/tools/utils'; import type { ManageTrainSchedulePathProperties } from 'applications/operationalStudies/types'; +import type { OperationalPointReference } from 'common/api/osrdEditoastApi'; import { pathStepMatchesOp } from 'modules/pathfinding/utils'; import type { SuggestedOP } from 'modules/trainschedule/components/ManageTrainSchedule/types'; import { addElementAtIndex } from 'utils/array'; @@ -90,7 +91,12 @@ export function upsertPathStep(statePathSteps: (PathStep | null)[], op: Suggeste if (stepIndex >= 0) { // Because of import issues, there can be multiple ops with same position on path // To avoid updating the wrong one, we need to find the one that matches the payload - newVia = { ...newVia, id: cleanPathSteps[stepIndex].id }; // We don't need to change the id of the updated via + newVia = { + ...newVia, + id: cleanPathSteps[stepIndex].id, + track_reference: + (cleanPathSteps[stepIndex] as OperationalPointReference).track_reference || undefined, + }; // We don't need to change the id of the updated via statePathSteps[stepIndex] = newVia; } else { // Because of import issues, there can be multiple ops at position 0