Skip to content

Commit

Permalink
🐛 Fix useFetchAssessments query key (#1390)
Browse files Browse the repository at this point in the history
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 <sdickers@redhat.com>
  • Loading branch information
sjd78 committed Sep 22, 2023
1 parent 44166ff commit 48dd6fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/app/queries/assessments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
Expand All @@ -29,6 +29,7 @@ export const useFetchAssessments = () => {
fetchError: error,
};
};

export const useCreateAssessmentMutation = (
isArchetype: boolean,
onSuccess: (name: string) => void,
Expand Down

0 comments on commit 48dd6fd

Please sign in to comment.