From 48dd6fd67efb41f33153ca96b2b7e615a2f0ca75 Mon Sep 17 00:00:00 2001 From: Scott Dickerson Date: Thu, 21 Sep 2023 20:11:16 -0400 Subject: [PATCH] :bug: Fix `useFetchAssessments` query key (#1390) The query key for `useFetchAssessments` was set to use the same query key as `useFetchQuestionnaires`. Setting the query keys to appropriate values prevent a situation where the first use of one of them will cause them both to have the same response. Having an `Assessment[]` returned instead of a `Questionnaire[]`, or vice versa, does cause some problems. Signed-off-by: Scott J Dickerson --- client/src/app/queries/assessments.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/app/queries/assessments.ts b/client/src/app/queries/assessments.ts index 3fbd06d57..853b38b88 100644 --- a/client/src/app/queries/assessments.ts +++ b/client/src/app/queries/assessments.ts @@ -19,7 +19,7 @@ export const assessmentsByItemIdQueryKey = "assessmentsByItemId"; export const useFetchAssessments = () => { const { isLoading, data, error } = useQuery({ - queryKey: [QuestionnairesQueryKey], + queryKey: [assessmentsQueryKey], queryFn: getAssessments, onError: (error: AxiosError) => console.log("error, ", error), }); @@ -29,6 +29,7 @@ export const useFetchAssessments = () => { fetchError: error, }; }; + export const useCreateAssessmentMutation = ( isArchetype: boolean, onSuccess: (name: string) => void,