Skip to content

Commit

Permalink
[front/components/assistant/conversation] - refactor: streamline dele…
Browse files Browse the repository at this point in the history
…tion notification logic (#8375)

- Consolidated the logic to create a notification message when deleting conversations
 - Removed unnecessary dependency array elements in useCallback for better performance and simplicity

Co-authored-by: Jules <[email protected]>
  • Loading branch information
JulesBelveze and Jules authored Oct 31, 2024
1 parent d467cfc commit b56d845
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions front/components/assistant/conversation/SidebarMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,11 @@ export function AssistantSidebarMenu({ owner }: AssistantSidebarMenuProps) {
type: "success",
title: "Conversations successfully deleted",
description:
conversations.length > 1
? `${conversations.length} conversations have been deleted.`
: `${conversations.length} conversation has been deleted.`,
selectedConversations.length > 1
? `${selectedConversations.length} conversations have been deleted.`
: `${selectedConversations.length} conversation has been deleted.`,
});
}, [
conversations.length,
doDelete,
selectedConversations,
sendNotification,
toggleMultiSelect,
]);
}, [doDelete, selectedConversations, sendNotification, toggleMultiSelect]);

const deleteAll = useCallback(async () => {
setIsDeleting(true);
Expand Down

0 comments on commit b56d845

Please sign in to comment.