{intermediatePoints.length > 0 &&
intermediatePoints.map((pathStep, index) => {
const pathStepId = index + 1;
+ function deleteViaV2(index: number): any {
+ throw new Error('Function not implemented.');
+ }
+
return (
-
- } // TODO: Remove icon and clear button -> replace them by the "numbered point" icon
+ }
hasTip
disabled={disabled}
>
diff --git a/front/src/modules/pathfinding/components/Pathfinding/PathfindingV2.tsx b/front/src/modules/pathfinding/components/Pathfinding/PathfindingV2.tsx
index e7acfd54215..52bd3457e6b 100644
--- a/front/src/modules/pathfinding/components/Pathfinding/PathfindingV2.tsx
+++ b/front/src/modules/pathfinding/components/Pathfinding/PathfindingV2.tsx
@@ -33,10 +33,7 @@ const Pathfinding = ({ pathProperties, setPathProperties }: PathfindingProps) =>
const {
pathfindingState,
infraInfos: { infra, reloadCount },
- } = usePathfindingV2({
- pathProperties,
- setPathProperties,
- });
+ } = usePathfindingV2(setPathProperties, pathProperties);
const missingElements = conditionalStringConcat([
[!origin, t('origin')],
diff --git a/front/src/modules/pathfinding/hook/useInfra.ts b/front/src/modules/pathfinding/hook/useInfra.ts
deleted file mode 100644
index f503eac60be..00000000000
--- a/front/src/modules/pathfinding/hook/useInfra.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-import { useState, useEffect } from 'react';
-
-import { isEqual } from 'lodash';
-import { useSelector } from 'react-redux';
-
-import { osrdEditoastApi } from 'common/api/osrdEditoastApi';
-import { useOsrdConfSelectors } from 'common/osrdContext';
-
-export default function useInfra() {
- const { getInfraID } = useOsrdConfSelectors();
- const infraId = useSelector(getInfraID, isEqual);
-
- const [reloadInfra] = osrdEditoastApi.endpoints.postInfraByInfraIdLoad.useMutation();
-
- const [isInfraLoaded, setIsInfraLoaded] = useState(false);
- const [reloadCount, setReloadCount] = useState(1);
- const [isInfraError, setIsInfraError] = useState(false);
-
- const { data: infra } = osrdEditoastApi.endpoints.getInfraByInfraId.useQuery(
- { infraId: infraId as number },
- {
- refetchOnMountOrArgChange: true,
- pollingInterval: !isInfraLoaded ? 1000 : undefined,
- }
- );
-
- useEffect(() => {
- if (reloadCount <= 5 && infra && infra.state === 'TRANSIENT_ERROR') {
- setTimeout(() => {
- reloadInfra({ infraId: infraId as number }).unwrap();
- setReloadCount((count) => count + 1);
- }, 1000);
- }
- }, [infra, reloadCount]);
-
- useEffect(() => {
- if (infra) {
- switch (infra.state) {
- case 'NOT_LOADED': {
- reloadInfra({ infraId: infraId as number }).unwrap();
- setIsInfraLoaded(false);
- break;
- }
- case 'ERROR':
- case 'TRANSIENT_ERROR': {
- setIsInfraLoaded(true);
- break;
- }
- case 'CACHED': {
- setIsInfraLoaded(true);
- if (isInfraError) setIsInfraError(false);
- break;
- }
- default:
- break;
- }
- }
- }, [infra]);
-
- useEffect(() => {
- if (isInfraError) {
- reloadInfra({ infraId: infraId as number }).unwrap();
- setIsInfraLoaded(false);
- }
- }, [isInfraError]);
-
- return {
- reloadCount,
- setIsInfraError,
- infra,
- };
-}