@@ -69,7 +69,7 @@ const usePathfinding = (
69
69
const setError = ( error ?: string ) => setPathfindingState ( { ...initialPathfindingState , error } ) ;
70
70
71
71
const handleInvalidPathItems = (
72
- steps : ( PathStep | null ) [ ] ,
72
+ steps : PathStep [ ] ,
73
73
invalidPathItems : Extract < PathfindingInputError , { error_type : 'invalid_path_items' } > [ 'items' ]
74
74
) => {
75
75
// TODO: we currently only handle invalid pathSteps with trigram. We will have to do it for trackOffset, opId and uic too.
@@ -175,7 +175,7 @@ const usePathfinding = (
175
175
dispatch ( replaceItinerary ( steps ) ) ;
176
176
setPathProperties ( undefined ) ;
177
177
178
- if ( steps . some ( ( step ) => step = == null ) ) {
178
+ if ( ! steps . every ( ( step ) => step ! == null ) ) {
179
179
setIsMissingParam ( ) ;
180
180
return ;
181
181
}
@@ -188,7 +188,7 @@ const usePathfinding = (
188
188
const pathfindingInput = getPathfindingQuery ( {
189
189
infraId,
190
190
rollingStock,
191
- pathSteps : steps . filter ( ( step ) => step !== null && ! step . isInvalid ) ,
191
+ pathSteps : steps . filter ( ( step ) => ! step . isInvalid ) ,
192
192
} ) ;
193
193
194
194
if ( ! pathfindingInput ) {
@@ -200,10 +200,7 @@ const usePathfinding = (
200
200
const pathfindingResult = await postPathfindingBlocks ( pathfindingInput ) . unwrap ( ) ;
201
201
202
202
if ( pathfindingResult . status === 'success' ) {
203
- await populateStoreWithPathfinding (
204
- steps . map ( ( step ) => step ! ) ,
205
- pathfindingResult
206
- ) ;
203
+ await populateStoreWithPathfinding ( steps , pathfindingResult ) ;
207
204
setIsDone ( ) ;
208
205
return ;
209
206
}
@@ -214,7 +211,7 @@ const usePathfinding = (
214
211
215
212
if ( incompatibleConstraintsCheck ) {
216
213
await populateStoreWithPathfinding (
217
- steps . map ( ( step ) => step ! ) ,
214
+ steps ,
218
215
pathfindingResult . relaxed_constraints_path ,
219
216
pathfindingResult . incompatible_constraints
220
217
) ;
0 commit comments