From 82fd6bed09a98c6d2c6fb13c17c230dac1543d92 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Tue, 2 Sep 2025 13:02:47 +0000 Subject: [PATCH] Update admin page to refresh video data after edits Refactor: Invalidate cache for '/api/admin/videos' and '/api/videos' in EditVideoDialog to refresh video data upon successful update. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 170e18f0-0f13-4eca-8643-546bba1dd8cc Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/170e18f0-0f13-4eca-8643-546bba1dd8cc/LY6xmBI --- client/src/pages/admin.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/src/pages/admin.tsx b/client/src/pages/admin.tsx index 33a1564..914f468 100644 --- a/client/src/pages/admin.tsx +++ b/client/src/pages/admin.tsx @@ -209,6 +209,7 @@ function EditVideoDialog({ onSuccess: () => void; }) { const { toast } = useToast(); + const queryClient = useQueryClient(); const [formData, setFormData] = useState({ title: video.title, description: video.description, @@ -225,6 +226,10 @@ function EditVideoDialog({ title: "Success", description: "Video updated successfully", }); + // Invalidate cache to refresh the video list + queryClient.invalidateQueries({ queryKey: ["/api/admin/videos"] }); + queryClient.invalidateQueries({ queryKey: ["/api/videos"] }); + onOpenChange(false); onSuccess(); }, onError: (error: any) => {