From c40f755cac7663589ae8399f0b1a9e8ab8ca0b0a Mon Sep 17 00:00:00 2001 From: Mckay Wrigley Date: Wed, 15 Mar 2023 08:32:21 -0600 Subject: [PATCH] fix deletion bug --- README.md | 2 +- components/Sidebar/Conversations.tsx | 1 + pages/index.tsx | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ecf43ca..6dc02a2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ It aims to mimic ChatGPT's interface and functionality. All conversations are stored locally on your device. -See a [demo]() +See a [demo](). ![Chatbot UI Pro](./public/screenshot.png) diff --git a/components/Sidebar/Conversations.tsx b/components/Sidebar/Conversations.tsx index ec97bda..e3a0d85 100644 --- a/components/Sidebar/Conversations.tsx +++ b/components/Sidebar/Conversations.tsx @@ -11,6 +11,7 @@ interface Props { } export const Conversations: FC = ({ loading, conversations, selectedConversation, onSelectConversation, onDeleteConversation }) => { + console.log(conversations); return (
{conversations.map((conversation, index) => ( diff --git a/pages/index.tsx b/pages/index.tsx index 51ae250..ca730da 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -119,8 +119,10 @@ export default function Home() { }; const handleNewConversation = () => { + const lastConversation = conversations[conversations.length - 1]; + const newConversation: Conversation = { - id: conversations.length + 1, + id: lastConversation ? lastConversation.id + 1 : 1, name: "", messages: [] };