@@ -59,26 +59,24 @@ const useWaypointMenu = (waypointsPanelData?: WaypointsPanelData) => {
59
59
disabledMessage : t ( 'waypointsPanel.warning' ) ,
60
60
onClick : ( ) => {
61
61
closeMenu ( ) ;
62
- if ( setFilteredWaypoints ) {
63
- setFilteredWaypoints ( ( prevFilteredWaypoints ) => {
64
- const newFilteredWaypoints = prevFilteredWaypoints . filter (
65
- ( waypoint ) => waypoint . id !== activeWaypointId
66
- ) ;
67
-
68
- // We need to removed the id because it can change for waypoints added by map click
69
- const simplifiedPath = projectionPath ?. map ( ( waypoint ) =>
70
- omit ( waypoint , [ 'id' , 'deleted' ] )
71
- ) ;
72
-
73
- // TODO : when switching to the manchette back-end manager, remove all logic using
74
- // cleanScenarioLocalStorage from projet/study/scenario components (single/multi select)
75
- localStorage . setItem (
76
- `${ timetableId } -${ JSON . stringify ( simplifiedPath ) } ` ,
77
- JSON . stringify ( newFilteredWaypoints )
78
- ) ;
79
- return newFilteredWaypoints ;
80
- } ) ;
81
- }
62
+ setFilteredWaypoints ?.( ( prevFilteredWaypoints ) => {
63
+ const newFilteredWaypoints = prevFilteredWaypoints . filter (
64
+ ( waypoint ) => waypoint . id !== activeWaypointId
65
+ ) ;
66
+
67
+ // We need to removed the id because it can change for waypoints added by map click
68
+ const simplifiedPath = projectionPath ?. map ( ( waypoint ) =>
69
+ omit ( waypoint , [ 'id' , 'deleted' ] )
70
+ ) ;
71
+
72
+ // TODO : when switching to the manchette back-end manager, remove all logic using
73
+ // cleanScenarioLocalStorage from projet/study/scenario components (single/multi select)
74
+ localStorage . setItem (
75
+ `${ timetableId } -${ JSON . stringify ( simplifiedPath ) } ` ,
76
+ JSON . stringify ( newFilteredWaypoints )
77
+ ) ;
78
+ return newFilteredWaypoints ;
79
+ } ) ;
82
80
} ,
83
81
} ,
84
82
] ;
0 commit comments