Skip to content

Commit

Permalink
invalidate cost-surfaces query after upload
Browse files Browse the repository at this point in the history
  • Loading branch information
anamontiaga committed Dec 13, 2023
1 parent 5ea4b10 commit ecea49f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
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 @@ -51,6 +52,8 @@ export const CostSurfaceUploadModal = ({

const { addToast } = useToasts();

const queryClient = useQueryClient();

const uploadProjectCostSurfaceMutation = useUploadProjectCostSurface();

const downloadShapefileTemplateMutation = useDownloadShapefileTemplate();
Expand Down Expand Up @@ -118,6 +121,7 @@ export const CostSurfaceUploadModal = ({
{
onSuccess: () => {
setSuccessFile({ ...successFile });
queryClient.invalidateQueries(['cost-surfaces', pid]);
onClose();
addToast(
'success-upload-cost-surface-file',
Expand Down Expand Up @@ -163,7 +167,7 @@ export const CostSurfaceUploadModal = ({
}
);
},
[pid, addToast, onClose, uploadProjectCostSurfaceMutation, successFile]
[pid, addToast, onClose, uploadProjectCostSurfaceMutation, successFile, queryClient]
);

const { getRootProps, getInputProps, isDragActive, isDragAccept, isDragReject } = useDropzone({
Expand Down
2 changes: 1 addition & 1 deletion app/layout/projects/show/map/legend/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export const useInventoryLegend = ({
]
: []),
{
name: 'Cost Surface',
name: 'Cost Surfacex',
layers: useCostSurfaceLegend(),
},
],
Expand Down
1 change: 1 addition & 0 deletions app/layout/projects/show/status/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const ProjectStatus = (): JSX.Element => {
const { jobs = [] } = scenarioStatusData || {};

// Jobs

const JOBS = useProjectJobs(jobs);

// Failure
Expand Down

0 comments on commit ecea49f

Please sign in to comment.