Skip to content

Commit

Permalink
front: fix timetable train selection
Browse files Browse the repository at this point in the history
no train was selected after deleting the selected train
  • Loading branch information
SharglutDev committed Nov 23, 2023
1 parent 6958130 commit ba5cc2c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export function selectProjection(
const trainSchedulesIds = trainSchedules.map((train) => train.id);

// if the projected train still exists, keep it
if (trainSchedulesIds.includes(currentProjection.id)) return;
if (trainSchedulesIds.includes(currentProjection.id)) {
if (!selectedTrainId) store.dispatch(updateSelectedTrainId(trainSchedules[0].id));
return;
}

// if the projected train has been deleted but an other train has the same path,
// keep the path and select this train
Expand Down

0 comments on commit ba5cc2c

Please sign in to comment.