@@ -9,7 +9,7 @@ import ModalBodySNCF from 'common/BootstrapSNCF/ModalSNCF/ModalBodySNCF';
9
9
import ModalFooterSNCF from 'common/BootstrapSNCF/ModalSNCF/ModalFooterSNCF' ;
10
10
import ModalHeaderSNCF from 'common/BootstrapSNCF/ModalSNCF/ModalHeaderSNCF' ;
11
11
import { useOsrdConfActions , useOsrdConfSelectors } from 'common/osrdContext' ;
12
- import { isVia , matchPathStepAndOp } from 'modules/pathfinding/utils' ;
12
+ import { isVia } from 'modules/pathfinding/utils' ;
13
13
import type { SuggestedOP } from 'modules/trainschedule/components/ManageTrainSchedule/types' ;
14
14
import { useAppDispatch } from 'store' ;
15
15
import { formatUicToCi } from 'utils/strings' ;
@@ -20,11 +20,10 @@ type ModalSuggestedViasProps = {
20
20
21
21
const ModalSuggestedVias = ( { suggestedVias } : ModalSuggestedViasProps ) => {
22
22
const { upsertViaFromSuggestedOP, clearVias, removeVia } = useOsrdConfActions ( ) ;
23
- const { getVias, getDestination, getPathSteps } = useOsrdConfSelectors ( ) ;
23
+ const { getVias, getDestination } = useOsrdConfSelectors ( ) ;
24
24
const dispatch = useAppDispatch ( ) ;
25
25
const vias = useSelector ( getVias ( ) ) ;
26
26
const destination = useSelector ( getDestination ) ;
27
- const pathSteps = useSelector ( getPathSteps ) ;
28
27
const { t } = useTranslation ( 'operationalStudies/manageTrainSchedule' ) ;
29
28
30
29
const isOriginOrDestination = useCallback (
@@ -33,12 +32,7 @@ const ModalSuggestedVias = ({ suggestedVias }: ModalSuggestedViasProps) => {
33
32
[ destination ]
34
33
) ;
35
34
36
- const removeViaFromPath = ( op : SuggestedOP ) => {
37
- const pathStepToRemove = pathSteps . find ( ( step ) => step && matchPathStepAndOp ( step , op ) ) ;
38
- if ( pathStepToRemove ) {
39
- dispatch ( removeVia ( pathStepToRemove . id ) ) ;
40
- }
41
- } ;
35
+ const removeViaFromPath = ( op : SuggestedOP ) => dispatch ( removeVia ( op ) ) ;
42
36
43
37
const formatOP = ( op : SuggestedOP , idx : number , idxTrueVia : number ) => {
44
38
const isInVias = isVia ( vias , op ) ;
0 commit comments