Skip to content

Commit

Permalink
Fix invalidate queries after assessment patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 committed Sep 8, 2023
1 parent d6f0688 commit 07cdf8e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
import { AxiosError } from "axios";
import {
assessmentQueryKey,
assessmentsByAppIdQueryKey,
assessmentsQueryKey,
usePatchAssessmentMutation,
} from "@app/queries/assessments";
Expand Down Expand Up @@ -69,11 +70,9 @@ export const ApplicationAssessmentWizard: React.FC<
const queryClient = useQueryClient();
const { questionnaires } = useFetchQuestionnaires();
const onHandleSuccessfulPatch = () => {
console.log("hi");
queryClient.invalidateQueries([
assessmentQueryKey,
assessmentsQueryKey,
QuestionnairesQueryKey,
assessmentsByAppIdQueryKey,
assessment?.application?.id,
]);
};
const { mutate: patchAssessmentMutation } = usePatchAssessmentMutation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const AssessmentActionsTable: React.FC<AssessmentActionsTableProps> = ({
useFetchQuestionnaires();
const { assessments, isFetching: isFetchingAssessmentsById } =
useFetchAssessmentsByAppId(application?.id || "");
// Separate required questionnaires

const requiredQuestionnaires = questionnaires.filter(
(questionnaire) => questionnaire.required
);
Expand Down
1 change: 1 addition & 0 deletions client/src/app/queries/assessments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export const useFetchAssessmentsByAppId = (applicationId: number | string) => {
queryKey: [assessmentsByAppIdQueryKey, applicationId],
queryFn: () => getAssessmentsByAppId(applicationId),
onError: (error: AxiosError) => console.log("error, ", error),
onSuccess: (data) => {},
});
return {
assessments: data,
Expand Down

0 comments on commit 07cdf8e

Please sign in to comment.