diff --git a/frontend/cypress/e2e/main_window/interest_point.spec.ts b/frontend/cypress/e2e/main_window/interest_point.spec.ts index 075854330..594f14d0a 100644 --- a/frontend/cypress/e2e/main_window/interest_point.spec.ts +++ b/frontend/cypress/e2e/main_window/interest_point.spec.ts @@ -48,6 +48,7 @@ context('InterestPoint', () => { cy.getDataCy('interest-point').click() cy.getDataCy('dms-coordinates-input').eq(1).should('have.value', '__° __′ __″ _ ___° __′ __″ _') + cy.wait(400) cy.get('#root').click(650, 690) cy.getDataCy('interest-point-name-input').type('Phénomène 3') cy.getDataCy('interest-point-observations-input').type('Est encore encore dans la bergerie') diff --git a/frontend/package-lock.json b/frontend/package-lock.json index bc10b2a9b..377408c8d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -28,6 +28,7 @@ "lodash": "4.17.21", "ol": "6.15.1", "ol-mapbox-style": "6.9.0", + "ramda": "0.29.1", "react": "18.2.0", "react-coordinate-input": "^1.0.0-rc.2", "react-device-detect": "2.2.3", diff --git a/frontend/src/api/missionsAPI.ts b/frontend/src/api/missionsAPI.ts index 5a675ec3c..4e26ca4d2 100644 --- a/frontend/src/api/missionsAPI.ts +++ b/frontend/src/api/missionsAPI.ts @@ -90,6 +90,7 @@ export const missionsAPI = monitorenvPrivateApi.injectEndpoints({ export const publicMissionsAPI = monitorenvPublicApi.injectEndpoints({ endpoints: builder => ({ getEngagedControlUnits: builder.query, void>({ + forceRefetch: () => true, query: () => `/v1/missions/engaged_control_units` }) }) diff --git a/frontend/src/features/Reportings/Layers/MissionToAttach/SelectedMissionToAttachLayer.tsx b/frontend/src/features/Reportings/Layers/MissionToAttach/SelectedMissionToAttachLayer.tsx index 3fe06de14..7ca3987b9 100644 --- a/frontend/src/features/Reportings/Layers/MissionToAttach/SelectedMissionToAttachLayer.tsx +++ b/frontend/src/features/Reportings/Layers/MissionToAttach/SelectedMissionToAttachLayer.tsx @@ -24,7 +24,8 @@ export function SelectedMissionToAttachLayer({ map }: BaseMapChildrenProps) { const { selectedMission: attachedMission } = useGetMissionsQuery(undefined, { selectFromResult: ({ data }) => ({ selectedMission: data?.find(mission => mission.id === missionId && !editedReporting?.detachedFromMissionAtUtc) - }) + }), + skip: !missionId }) const selectedAttachedMissionVectorSourceRef = useRef(new VectorSource()) as MutableRefObject diff --git a/frontend/src/features/Reportings/Layers/MissionToAttach/index.tsx b/frontend/src/features/Reportings/Layers/MissionToAttach/index.tsx index eaf1c0b00..ea7720b40 100644 --- a/frontend/src/features/Reportings/Layers/MissionToAttach/index.tsx +++ b/frontend/src/features/Reportings/Layers/MissionToAttach/index.tsx @@ -22,10 +22,13 @@ export function MissionToAttachLayer({ map, mapClickEvent }: BaseMapChildrenProp state => state.attachMissionToReporting.isMissionAttachmentInProgress ) - const { data: missions } = useGetMissionsQuery({ - missionStatus: [MissionStatusEnum.PENDING], - startedAfterDateTime: customDayjs.utc().startOf('day').utc().subtract(90, 'day').toISOString() - }) + const { data: missions } = useGetMissionsQuery( + { + missionStatus: [MissionStatusEnum.PENDING], + startedAfterDateTime: customDayjs.utc().startOf('day').subtract(90, 'day').toISOString() + }, + { skip: !isMissionAttachmentInProgress } + ) const missionsMultiPolygons = useMemo( () => diff --git a/frontend/src/features/map/layers/Missions/SelectedMissionLayer.ts b/frontend/src/features/map/layers/Missions/SelectedMissionLayer.ts index 4a3ab3dcf..cfdb34c6c 100644 --- a/frontend/src/features/map/layers/Missions/SelectedMissionLayer.ts +++ b/frontend/src/features/map/layers/Missions/SelectedMissionLayer.ts @@ -17,7 +17,8 @@ export function SelectedMissionLayer({ map }: BaseMapChildrenProps) { const { selectedMission } = useGetMissionsQuery(undefined, { selectFromResult: ({ data }) => ({ selectedMission: data?.find(op => op.id === selectedMissionIdOnMap) - }) + }), + skip: !selectedMissionIdOnMap }) const hasNoMissionDuplication = useMemo(() => { diff --git a/frontend/src/features/missions/Layers/ReportingToAttach/index.tsx b/frontend/src/features/missions/Layers/ReportingToAttach/index.tsx index 904063d01..26bdbe4c8 100644 --- a/frontend/src/features/missions/Layers/ReportingToAttach/index.tsx +++ b/frontend/src/features/missions/Layers/ReportingToAttach/index.tsx @@ -24,9 +24,12 @@ export function ReportingToAttachLayer({ map, mapClickEvent }: BaseMapChildrenPr ) const attachedReportings = useAppSelector(state => state.attachReportingToMission.attachedReportings) - const { data: reportings } = useGetReportingsQuery({ - status: [StatusFilterEnum.IN_PROGRESS] - }) + const { data: reportings } = useGetReportingsQuery( + { + status: [StatusFilterEnum.IN_PROGRESS] + }, + { skip: !isReportingAttachmentInProgress } + ) const attachedReportingsFeatures = useMemo( () => diff --git a/frontend/src/features/missions/MissionForm/ControlUnitsForm/ControlUnitSelector.tsx b/frontend/src/features/missions/MissionForm/ControlUnitsForm/ControlUnitSelector.tsx index a964088cd..39983eaf8 100644 --- a/frontend/src/features/missions/MissionForm/ControlUnitsForm/ControlUnitSelector.tsx +++ b/frontend/src/features/missions/MissionForm/ControlUnitsForm/ControlUnitSelector.tsx @@ -127,7 +127,6 @@ export function ControlUnitSelector({ controlUnitIndex, removeControlUnit }: Con } const { data: engagedControlUnits = [] } = useGetEngagedControlUnitsQuery(undefined, { - ...RTK_DEFAULT_QUERY_OPTIONS, skip: !missionIsNewMission })