Skip to content

Commit

Permalink
✨ [backport release-0.2] Tags: Mark stall data after create/edit muta…
Browse files Browse the repository at this point in the history
…tion (#1098) (#1120)

Resolves https://issues.redhat.com/browse/MTA-802

(cherry picked from commit 1af3f9d)
  • Loading branch information
gildub authored Jul 12, 2023
1 parent b3cb1b8 commit 71cab52
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion client/src/app/pages/controls/tags/components/tag-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { AxiosError, AxiosResponse } from "axios";
import { object, string, mixed } from "yup";

import {
ActionGroup,
Button,
Expand Down
1 change: 0 additions & 1 deletion client/src/app/pages/controls/tags/tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useState } from "react";
import { AxiosError, AxiosResponse } from "axios";
import { useTranslation } from "react-i18next";
import { useSelectionState } from "@migtools/lib-ui";

import {
Button,
ButtonVariant,
Expand Down
14 changes: 7 additions & 7 deletions client/src/app/queries/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const useFetchTags = () => {

export const useFetchTagCategories = () => {
const { data, isLoading, error, refetch } = useQuery({
queryKey: [TagCategoriesQueryKey],
queryKey: [TagCategoriesQueryKey, TagsQueryKey],
queryFn: getTagCategories,
onError: (error: AxiosError) => console.log("error, ", error),
});
Expand All @@ -53,11 +53,11 @@ export const useCreateTagMutation = (
mutationFn: createTag,
onSuccess: (res) => {
onSuccess(res);
queryClient.invalidateQueries([TagsQueryKey]);
queryClient.invalidateQueries([TagCategoriesQueryKey, TagsQueryKey]);
},
onError: (err: AxiosError) => {
onError(err);
queryClient.invalidateQueries([TagsQueryKey]);
queryClient.invalidateQueries([TagCategoriesQueryKey, TagsQueryKey]);
},
});
};
Expand Down Expand Up @@ -91,11 +91,11 @@ export const useUpdateTagMutation = (
mutationFn: updateTag,
onSuccess: (res) => {
onSuccess(res);
queryClient.invalidateQueries([TagsQueryKey]);
queryClient.invalidateQueries([TagCategoriesQueryKey, TagsQueryKey]);
},
onError: (err: AxiosError) => {
onError(err);
queryClient.invalidateQueries([TagsQueryKey]);
queryClient.invalidateQueries([TagCategoriesQueryKey, TagsQueryKey]);
},
});
};
Expand Down Expand Up @@ -128,11 +128,11 @@ export const useDeleteTagMutation = (
mutationFn: deleteTag,
onSuccess: (res) => {
onSuccess(res);
queryClient.invalidateQueries([TagsQueryKey]);
queryClient.invalidateQueries([TagCategoriesQueryKey, TagsQueryKey]);
},
onError: (err: AxiosError) => {
onError(err);
queryClient.invalidateQueries([TagsQueryKey]);
queryClient.invalidateQueries([TagCategoriesQueryKey, TagsQueryKey]);
},
});
};
Expand Down

0 comments on commit 71cab52

Please sign in to comment.