From eac8c7a77f58c394cc358f1a8470dd656cf1b9a4 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 14:12:57 +0000 Subject: [PATCH] Add robust loading cleanup Ensure Resolve button clears loading state with proper try-catch-finally around async resolution, preventing stuck loading indicator and improving error handling. --- src/components/admin/PipelineHealthAlerts.tsx | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/admin/PipelineHealthAlerts.tsx b/src/components/admin/PipelineHealthAlerts.tsx index cbd3ad98..85d74299 100644 --- a/src/components/admin/PipelineHealthAlerts.tsx +++ b/src/components/admin/PipelineHealthAlerts.tsx @@ -66,14 +66,20 @@ export function PipelineHealthAlerts() { if (error) { console.error('❌ Error resolving alert:', error); toast.error('Failed to resolve alert'); - } else { - console.log('✅ Alert resolved successfully'); - toast.success('Alert resolved'); - - // Invalidate queries to refresh the UI - queryClient.invalidateQueries({ queryKey: queryKeys.monitoring.systemAlerts() }); - queryClient.invalidateQueries({ queryKey: queryKeys.monitoring.systemHealth() }); + return; } + + console.log('✅ Alert resolved successfully'); + toast.success('Alert resolved'); + + // Invalidate queries to refresh the UI + await Promise.all([ + queryClient.invalidateQueries({ queryKey: queryKeys.monitoring.systemAlerts() }), + queryClient.invalidateQueries({ queryKey: queryKeys.monitoring.systemHealth() }) + ]); + } catch (err) { + console.error('❌ Unexpected error resolving alert:', err); + toast.error('An unexpected error occurred'); } finally { setResolvingAlertId(null); }