Skip to content

Commit

Permalink
invalidate query after upload
Browse files Browse the repository at this point in the history
  • Loading branch information
anamontiaga committed Sep 6, 2023
1 parent 2f465b1 commit 7388e80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const InventoryPanelProtectedAreas = ({
noData: string;
}): JSX.Element => {
const dispatch = useAppDispatch();

const { selectedWDPAs: visibleWDPAs, search } = useAppSelector(
(state) => state['/projects/[id]']
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';

import { useDropzone, DropzoneProps } from 'react-dropzone';
import { Form as FormRFF, Field as FieldRFF, FormProps } from 'react-final-form';
import { useQueryClient } from 'react-query';

import { useRouter } from 'next/router';

Expand Down Expand Up @@ -49,6 +50,7 @@ export const WDPAUploadModal = ({
const { pid } = query as { pid: string };

const { addToast } = useToasts();
const queryClient = useQueryClient();

const uploadWDPAsShapefileMutation = useUploadWDPAsShapefile({});

Expand Down Expand Up @@ -126,6 +128,7 @@ export const WDPAUploadModal = ({
level: 'success',
}
);
queryClient.invalidateQueries(['wdpas', pid]);
},
onError: (error: AxiosError | Error) => {
let errors: { status: number; title: string }[] = [];
Expand Down

0 comments on commit 7388e80

Please sign in to comment.