Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/desktop/src/components/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ export default function ChatInput({
},
compactIcon: <ScrollText size={12} />,
autoCompactThreshold: autoCompactThreshold,
key: `context-${numTokens}-${tokenLimit}`, // Force re-render on token count change

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't strike me as the correct solution, at most a work around? why are we not rerendering this when the numTokens changes? it is in the alert properties. do we do a shallow compare somewhere?

});
}

Expand Down
3 changes: 2 additions & 1 deletion ui/desktop/src/components/alerts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ export interface Alert {
compactButtonDisabled?: boolean;
onCompact?: () => void;
compactIcon?: React.ReactNode;
autoCompactThreshold?: number; // Add this for showing the auto-compact threshold
autoCompactThreshold?: number;
key?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ export default function BottomMenuAlertPopover({ alerts }: AlertPopoverProps) {
// Find new or changed alerts
const changedAlerts = alerts.filter((alert, index) => {
const prevAlert = previousAlertsRef.current[index];
return !prevAlert || prevAlert.type !== alert.type || prevAlert.message !== alert.message;
return (
!prevAlert ||
prevAlert.type !== alert.type ||
prevAlert.message !== alert.message ||
prevAlert.key !== alert.key

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see, the problem is that we don't detect changes in the right way. this should just do a deep compare I think

);
});

previousAlertsRef.current = alerts;
Expand Down
Loading