From 74517615c58b51a03e4f018e84fcac79b99f8166 Mon Sep 17 00:00:00 2001 From: David Katz Date: Fri, 26 Sep 2025 14:02:29 -0400 Subject: [PATCH] Fix: Token count UI doesn't re-render if it's open. (#4822) --- ui/desktop/src/components/alerts/types.ts | 2 +- .../src/components/bottom_menu/BottomMenuAlertPopover.tsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/desktop/src/components/alerts/types.ts b/ui/desktop/src/components/alerts/types.ts index af886726..f7aba081 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 86a59ec0..a7288891 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;