Skip to content

Commit

Permalink
fix: revalidate and refetch silences on creation
Browse files Browse the repository at this point in the history
Fixes #2346
  • Loading branch information
mainawycliffe authored and moshloop committed Oct 15, 2024
1 parent 393cd29 commit 38e1344
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/pages/Settings/notifications/NotificationSilencedAddPage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import NotificationTabsLinks from "@flanksource-ui/components/Notifications/NotificationTabsLinks";
import NotificationSilenceForm from "@flanksource-ui/components/Notifications/SilenceNotificationForm/NotificationSilenceForm";
import { useQueryClient } from "@tanstack/react-query";
import { useNavigate } from "react-router-dom";

export default function NotificationSilencedAddPage() {
const navigate = useNavigate();
const client = useQueryClient();

return (
<NotificationTabsLinks activeTab={"Silences"} isAddSilence>
<div className="mx-auto flex h-full max-w-screen-md flex-1 flex-col px-6 py-6 pb-0">
<h3 className="px-4 text-xl font-semibold">Silence Notification</h3>
<NotificationSilenceForm
onSuccess={() => navigate("/notifications/silences")}
onSuccess={() => {
navigate("/notifications/silences");
client.invalidateQueries({
queryKey: ["notification_silences"]
});

client.refetchQueries({
queryKey: ["notification_silences"]
});
}}
/>
</div>
</NotificationTabsLinks>
Expand Down

0 comments on commit 38e1344

Please sign in to comment.