Skip to content

Commit 1943ff0

Browse files
committed
Fix: Token count UI doesn't re-render if it's open. (#4822)
1 parent 7624f67 commit 1943ff0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ui/desktop/src/components/alerts/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ export interface Alert {
2020
compactButtonDisabled?: boolean;
2121
onCompact?: () => void;
2222
compactIcon?: React.ReactNode;
23-
autoCompactThreshold?: number; // Add this for showing the auto-compact threshold
23+
autoCompactThreshold?: number;
2424
}

ui/desktop/src/components/bottom_menu/BottomMenuAlertPopover.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useRef, useEffect, useCallback, useState } from 'react';
22
import { FaCircle } from 'react-icons/fa';
3+
import { isEqual } from 'lodash';
34
import { cn } from '../../utils';
45
import { Alert, AlertType } from '../alerts';
56
import { AlertBox } from '../alerts';
@@ -104,10 +105,10 @@ export default function BottomMenuAlertPopover({ alerts }: AlertPopoverProps) {
104105
return;
105106
}
106107

107-
// Find new or changed alerts
108+
// Find new or changed alerts using deep comparison
108109
const changedAlerts = alerts.filter((alert, index) => {
109110
const prevAlert = previousAlertsRef.current[index];
110-
return !prevAlert || prevAlert.type !== alert.type || prevAlert.message !== alert.message;
111+
return !prevAlert || !isEqual(prevAlert, alert);
111112
});
112113

113114
previousAlertsRef.current = alerts;

0 commit comments

Comments
 (0)