diff --git a/ui/desktop/src/components/alerts/types.ts b/ui/desktop/src/components/alerts/types.ts index af8867261836..f7aba0815087 100644 --- a/ui/desktop/src/components/alerts/types.ts +++ b/ui/desktop/src/components/alerts/types.ts @@ -20,5 +20,5 @@ export interface Alert { compactButtonDisabled?: boolean; onCompact?: () => void; compactIcon?: React.ReactNode; - autoCompactThreshold?: number; // Add this for showing the auto-compact threshold + autoCompactThreshold?: number; } diff --git a/ui/desktop/src/components/bottom_menu/BottomMenuAlertPopover.tsx b/ui/desktop/src/components/bottom_menu/BottomMenuAlertPopover.tsx index 86a59ec013e8..a7288891f0ca 100644 --- a/ui/desktop/src/components/bottom_menu/BottomMenuAlertPopover.tsx +++ b/ui/desktop/src/components/bottom_menu/BottomMenuAlertPopover.tsx @@ -1,5 +1,6 @@ import { useRef, useEffect, useCallback, useState } from 'react'; import { FaCircle } from 'react-icons/fa'; +import { isEqual } from 'lodash'; import { cn } from '../../utils'; import { Alert, AlertType } from '../alerts'; import { AlertBox } from '../alerts'; @@ -104,10 +105,10 @@ export default function BottomMenuAlertPopover({ alerts }: AlertPopoverProps) { return; } - // Find new or changed alerts + // Find new or changed alerts using deep comparison const changedAlerts = alerts.filter((alert, index) => { const prevAlert = previousAlertsRef.current[index]; - return !prevAlert || prevAlert.type !== alert.type || prevAlert.message !== alert.message; + return !prevAlert || !isEqual(prevAlert, alert); }); previousAlertsRef.current = alerts;