Skip to content

Commit

Permalink
cleans scenarios cache after run scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
agnlez committed Oct 3, 2023
1 parent d17995e commit 0eb4a8a
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions app/hooks/scenarios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export function useScenariosStatusOnce({
};

return useMutation(saveScenarioLock, {
onSuccess: (data: any, variables, context) => {
onSuccess: (data, variables, context) => {
console.info('Success', data, variables, context);
},
onError: (error, variables, context) => {
Expand Down Expand Up @@ -286,7 +286,7 @@ export function useSaveScenarioLock({
};

return useMutation(saveScenarioLock, {
onSuccess: (data: any, variables) => {
onSuccess: (data, variables) => {
const { sid } = variables;
queryClient.invalidateQueries('project-locks');
queryClient.invalidateQueries(['scenario-lock', sid]);
Expand Down Expand Up @@ -317,7 +317,7 @@ export function useDeleteScenarioLock({
};

return useMutation(deleteScenarioLock, {
onSuccess: (data: any, variables) => {
onSuccess: (data, variables) => {
const { sid } = variables;
queryClient.invalidateQueries('project-locks');
queryClient.invalidateQueries(['scenario-lock', sid]);
Expand Down Expand Up @@ -578,7 +578,7 @@ export function useUploadScenarioPU({
};

return useMutation(uploadScenarioPUShapefile, {
onSuccess: (data: any, variables, context) => {
onSuccess: (data, variables, context) => {
console.info('Success', data, variables, context);
},
onError: (error, variables, context) => {
Expand Down Expand Up @@ -669,7 +669,7 @@ export function useUploadCostSurface({
};

return useMutation(uploadScenarioCostSurface, {
onSuccess: (data: any, variables, context) => {
onSuccess: (data, variables, context) => {
console.info('Success', data, variables, context);
},
onError: (error, variables, context) => {
Expand Down Expand Up @@ -760,7 +760,7 @@ export function useSaveScenarioPU({
};

return useMutation(saveScenario, {
onSuccess: (data: any, variables, context) => {
onSuccess: (data, variables, context) => {
console.info('Success', data, variables, context);
const { id } = variables;
queryClient.invalidateQueries(['scenarios-pu', id]);
Expand Down Expand Up @@ -791,8 +791,8 @@ export function useDuplicateScenario({
};

return useMutation(duplicateScenario, {
onSuccess: (data: any, variables, context) => {
queryClient.invalidateQueries(['scenarios']);
onSuccess: async (data, variables, context) => {
await queryClient.invalidateQueries(['scenarios']);
console.info('Success', data, variables, context);
},
onError: (error, variables, context) => {
Expand Down Expand Up @@ -825,6 +825,7 @@ export function useRunScenario({
return useMutation(runScenario, {
onSuccess: async (data, variables) => {
const { id } = variables;
await queryClient.invalidateQueries(['scenarios']);
await queryClient.invalidateQueries(['scenario', id]);
},
onError: (error, variables, context) => {
Expand Down Expand Up @@ -852,7 +853,7 @@ export function useCancelRunScenario({
};

return useMutation(duplicateScenario, {
onSuccess: (data: any, variables, context) => {
onSuccess: (data, variables, context) => {
console.info('Success', data, variables, context);
},
onError: (error, variables, context) => {
Expand Down Expand Up @@ -997,7 +998,7 @@ export function useSaveScenarioCalibrationRange({
};

return useMutation(saveScenarioCalibrationRange, {
onSuccess: (data: any, variables, context) => {
onSuccess: (data, variables, context) => {
console.info('Succcess', data, variables, context);
const { sid: scenarioId } = variables;
queryClient.invalidateQueries(['scenario-calibration', scenarioId]);
Expand Down Expand Up @@ -1034,7 +1035,7 @@ export function useDownloadScenarioReport({
};

return useMutation(downloadScenarioReport, {
onSuccess: (data: any, variables, context) => {
onSuccess: (data, variables, context) => {
const { data: blob } = data;
const url = window.URL.createObjectURL(new Blob([blob]));
const link = document.createElement('a');
Expand Down Expand Up @@ -1072,7 +1073,7 @@ export function useDeletePUScenaro() {
};

return useMutation(deletePUScenario, {
onSuccess: (data: any, variables, context) => {
onSuccess: (data, variables, context) => {
console.info('Success', data, variables, context);
// const { id } = variables;
// queryClient.invalidateQueries(['scenarios-pu', id]);
Expand Down

0 comments on commit 0eb4a8a

Please sign in to comment.