Skip to content

Commit fdca6f8

Browse files
committed
fix: invalidate query
1 parent 0459fd2 commit fdca6f8

File tree

1 file changed

+5
-2
lines changed
  • apps/dashboard/app/(main)/websites/[id]/flags

1 file changed

+5
-2
lines changed

apps/dashboard/app/(main)/websites/[id]/flags/page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { GATED_FEATURES } from "@databuddy/shared/types/features";
4-
import { useMutation, useQuery } from "@tanstack/react-query";
4+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
55
import { useAtom } from "jotai";
66
import { useParams } from "next/navigation";
77
import { Suspense, useMemo, useState } from "react";
@@ -41,6 +41,7 @@ const FlagsListSkeleton = () => (
4141
export default function FlagsPage() {
4242
const { id } = useParams();
4343
const websiteId = id as string;
44+
const queryClient = useQueryClient();
4445
const [isFlagSheetOpen, setIsFlagSheetOpen] = useAtom(isFlagSheetOpenAtom);
4546
const [editingFlag, setEditingFlag] = useState<Flag | null>(null);
4647
const [flagToDelete, setFlagToDelete] = useState<Flag | null>(null);
@@ -57,7 +58,9 @@ export default function FlagsPage() {
5758
const deleteFlagMutation = useMutation({
5859
...orpc.flags.delete.mutationOptions(),
5960
onSuccess: () => {
60-
orpc.flags.list.key({ input: { websiteId } });
61+
queryClient.invalidateQueries({
62+
queryKey: orpc.flags.list.key({ input: { websiteId } }),
63+
});
6164
},
6265
});
6366

0 commit comments

Comments
 (0)