diff --git a/front/src/modules/timesStops/hooks/useTimesStopsTableData.ts b/front/src/modules/timesStops/hooks/useTimesStopsTableData.ts index 3d53f1ae4bc..2e3c888ac1f 100644 --- a/front/src/modules/timesStops/hooks/useTimesStopsTableData.ts +++ b/front/src/modules/timesStops/hooks/useTimesStopsTableData.ts @@ -222,21 +222,31 @@ const useTimesStopsTableData = ( const pathStepRowsById = new Map( selectedTrain.path.map((pathStep, stepIndex) => { - const matchingOp = pathStepOps.get(pathStep.id)?.at(0); - - const name = getOperationalPointName( - matchingOp, - pathStep.location, - stepIndex, - selectedTrain.path.length, - t - ); + const pathStepOp = pathStepOps.get(pathStep.id)?.at(0); + + const matchingOp = + pathStepOp ?? + ('operational_point' in pathStep.location && stableOPs + ? stableOPs.find((op) => matchPathStepAndOp(pathStep.location, buildOpMatchParams(op))) + : undefined); + + const name = + matchingOp?.extensions?.identifier?.name ?? + getOperationalPointName( + pathStepOp, + pathStep.location, + stepIndex, + selectedTrain.path.length, + t + ); const pathStepLocation = pathStep.location; + // pathStepOp?.parts is only valid for RelatedOperationalPoint (track-offset steps); + // the stableOPs fallback never applies for those since it requires 'operational_point' in location. const trackName = 'track' in pathStepLocation - ? matchingOp?.parts.find((part) => part.track === pathStepLocation.track) + ? pathStepOp?.parts.find((part) => part.track === pathStepLocation.track) ?.local_track_name : (pathStepLocation.local_track_name ?? undefined);