mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 11:51:14 -05:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user