diff --git a/client/src/pages/Alerts.jsx b/client/src/pages/Alerts.jsx index ab09854..e285211 100644 --- a/client/src/pages/Alerts.jsx +++ b/client/src/pages/Alerts.jsx @@ -361,7 +361,14 @@ const Alerts = () => { - {t(`alerts.${rule.priority}`)} + {(() => { + // DEBUG: Check if priority is an object + if (typeof rule.priority === 'object' && rule.priority !== null) { + console.error('DEBUG: Priority is an object:', rule.priority, 'for rule:', rule.id); + return 'Invalid Priority'; + } + return t(`alerts.${rule.priority}`); + })()} @@ -369,6 +376,15 @@ const Alerts = () => { {(() => { // Normalize alert_channels - ensure it's always an array let alertChannels = rule.alert_channels || []; + + // DEBUG: Add debugging to catch object rendering + if (typeof alertChannels === 'object' && alertChannels !== null) { + const hasKeys = Object.keys(alertChannels).some(key => ['sms', 'webhook', 'email'].includes(key)); + if (hasKeys) { + console.log('DEBUG: Found problematic alert_channels object:', alertChannels, 'for rule:', rule.id); + } + } + if (typeof alertChannels === 'object' && !Array.isArray(alertChannels)) { // Convert object like {sms: true, webhook: false, email: true} to array alertChannels = Object.keys(alertChannels).filter(key => alertChannels[key]); @@ -376,14 +392,22 @@ const Alerts = () => { if (!Array.isArray(alertChannels)) { alertChannels = []; // fallback to empty array } - return alertChannels.map((channel, index) => ( - - {channel} - - )); + + // DEBUG: Ensure we're only rendering strings + return alertChannels.map((channel, index) => { + if (typeof channel !== 'string') { + console.error('DEBUG: Non-string channel detected:', channel, typeof channel); + return null; + } + return ( + + {channel} + + ); + }).filter(Boolean); })()}