From 864ca0797bd78179adbdf6a3621686016ed3e3be Mon Sep 17 00:00:00 2001 From: Rishabh Gusain Date: Sat, 22 Aug 2026 18:55:30 +0530 Subject: [PATCH] fix(dashboard): invalidate flag list with route website id --- .../[id]/flags/_components/flags-list.tsx | 22 ++++++++++++++----- .../app/(main)/websites/[id]/flags/page.tsx | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/dashboard/app/(main)/websites/[id]/flags/_components/flags-list.tsx b/apps/dashboard/app/(main)/websites/[id]/flags/_components/flags-list.tsx index 0ff938996..81a3e37bc 100644 --- a/apps/dashboard/app/(main)/websites/[id]/flags/_components/flags-list.tsx +++ b/apps/dashboard/app/(main)/websites/[id]/flags/_components/flags-list.tsx @@ -36,6 +36,7 @@ interface FlagsListProps { stats: Map; statsError: boolean; statsLoading: boolean; + websiteId: string; } const FLAG_LIST_MIN_WIDTH_CLASS = "min-w-[980px]"; @@ -77,7 +78,7 @@ function GroupsDisplay({ groups }: { groups: TargetGroup[] }) { ); } -function StatusToggle({ flag }: { flag: Flag }) { +function StatusToggle({ flag, websiteId }: { flag: Flag; websiteId: string }) { const queryClient = useQueryClient(); const isActive = flag.status === "active"; @@ -86,7 +87,7 @@ function StatusToggle({ flag }: { flag: Flag }) { onSuccess: () => { queryClient.invalidateQueries({ queryKey: orpc.flags.list.key({ - input: { websiteId: flag.websiteId ?? "" }, + input: { websiteId }, }), }); }, @@ -126,10 +127,12 @@ function StatusToggle({ flag }: { flag: Flag }) { function FlagActions({ flag, + websiteId, onEdit, onDelete, }: { flag: Flag; + websiteId: string; onEdit: (flag: Flag) => void; onDelete: (flagId: string) => void; }) { @@ -140,7 +143,7 @@ function FlagActions({ onSuccess: () => { queryClient.invalidateQueries({ queryKey: orpc.flags.list.key({ - input: { websiteId: flag.websiteId ?? "" }, + input: { websiteId }, }), }); }, @@ -405,6 +408,7 @@ function FlagRow({ statsLoading, onEdit, onDelete, + websiteId, }: { flag: Flag; groups: TargetGroup[]; @@ -416,6 +420,7 @@ function FlagRow({ statsLoading: boolean; onEdit: (flag: Flag) => void; onDelete: (flagId: string) => void; + websiteId: string; }) { const typeConfig = TYPE_CONFIG[flag.type as keyof typeof TYPE_CONFIG] ?? TYPE_CONFIG.boolean; @@ -517,12 +522,17 @@ function FlagRow({ Archived ) : ( - + )} - + ); @@ -531,6 +541,7 @@ function FlagRow({ export function FlagsList({ flags, groups, + websiteId, onRetryStats, stats, statsError, @@ -576,6 +587,7 @@ export function FlagsList({ statsLoading={statsLoading} onDelete={onDelete} onEdit={onEdit} + websiteId={websiteId} /> ))} diff --git a/apps/dashboard/app/(main)/websites/[id]/flags/page.tsx b/apps/dashboard/app/(main)/websites/[id]/flags/page.tsx index ce5e4b2b7..b14464c95 100644 --- a/apps/dashboard/app/(main)/websites/[id]/flags/page.tsx +++ b/apps/dashboard/app/(main)/websites/[id]/flags/page.tsx @@ -133,6 +133,7 @@ export default function FlagsPage() {