Skip to content

Commit

Permalink
fix: reset selectedChat in edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
igorlfs committed Dec 16, 2024
1 parent 57eaec1 commit ff729d1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
});
chats.push({ ...newChat, id });
// If there were no chats and we just added in the first one,
// We have to update `selectedChat` so it doesn't contain garbage
if (chats.length === 1) {
selectedChat = 0;
}
};
const deleteChat = async (idx: number) => {
Expand Down

0 comments on commit ff729d1

Please sign in to comment.