Skip to content

Commit 38e1344

Browse files
mainawycliffemoshloop
authored andcommitted
fix: revalidate and refetch silences on creation
Fixes #2346
1 parent 393cd29 commit 38e1344

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/pages/Settings/notifications/NotificationSilencedAddPage.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
import NotificationTabsLinks from "@flanksource-ui/components/Notifications/NotificationTabsLinks";
22
import NotificationSilenceForm from "@flanksource-ui/components/Notifications/SilenceNotificationForm/NotificationSilenceForm";
3+
import { useQueryClient } from "@tanstack/react-query";
34
import { useNavigate } from "react-router-dom";
45

56
export default function NotificationSilencedAddPage() {
67
const navigate = useNavigate();
8+
const client = useQueryClient();
79

810
return (
911
<NotificationTabsLinks activeTab={"Silences"} isAddSilence>
1012
<div className="mx-auto flex h-full max-w-screen-md flex-1 flex-col px-6 py-6 pb-0">
1113
<h3 className="px-4 text-xl font-semibold">Silence Notification</h3>
1214
<NotificationSilenceForm
13-
onSuccess={() => navigate("/notifications/silences")}
15+
onSuccess={() => {
16+
navigate("/notifications/silences");
17+
client.invalidateQueries({
18+
queryKey: ["notification_silences"]
19+
});
20+
21+
client.refetchQueries({
22+
queryKey: ["notification_silences"]
23+
});
24+
}}
1425
/>
1526
</div>
1627
</NotificationTabsLinks>

0 commit comments

Comments
 (0)