From b85a86fd17a0d7632c016ab1eb95970f685ef2ca Mon Sep 17 00:00:00 2001 From: Scotty Bollinger Date: Tue, 20 May 2025 15:51:43 -0500 Subject: [PATCH] Update history.tsx The current code is filtering based on id (from useParams() at the top), which is the ID of the chat currently being viewed in the URL, not the one being deleted. The code now correctly filters out the chat with the deleteId rather than the current URL id. This ensures that: 1. The correct chat is removed from the history list after deletion 2. The filter operation matches the chat being deleted rather than the currently viewed chat 3. The UI will update properly to reflect the deleted item --- components/custom/history.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/custom/history.tsx b/components/custom/history.tsx index 8c8b272..b8bd571 100644 --- a/components/custom/history.tsx +++ b/components/custom/history.tsx @@ -74,7 +74,7 @@ export const History = ({ user }: { user: User | undefined }) => { success: () => { mutate((history) => { if (history) { - return history.filter((h) => h.id !== id); + return history.filter((h) => h.id !== deleteId); } }); return "Chat deleted successfully";