From 287559e834875b2e0c16990c936ed82a0b6a73e4 Mon Sep 17 00:00:00 2001 From: Aryan Kothari <87589047+thearyadev@users.noreply.github.com> Date: Sat, 3 Aug 2024 19:42:45 -0400 Subject: [PATCH] fix: tag deletion rehydration bug fixes a bug that caused the deletion of a tag, when filtering by tag, to rehydrate all chats instead of the filtered list. --- src/lib/components/chat/Tags.svelte | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/components/chat/Tags.svelte b/src/lib/components/chat/Tags.svelte index 30e485ba0..19efa2662 100644 --- a/src/lib/components/chat/Tags.svelte +++ b/src/lib/components/chat/Tags.svelte @@ -47,26 +47,24 @@ }); await _tags.set(await getAllChatTags(localStorage.token)); - if ($_tags.map((t) => t.name).includes(tagName)) { if (tagName === 'pinned') { await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned')); } else { - await chats.set( - await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit) - ); + await chats.set(await getChatListByTagName(localStorage.token, tagName)); } if ($chats.find((chat) => chat.id === chatId)) { dispatch('close'); } } else { + // if the tag we deleted is no longer a valid tag, return to main chat list view + tagView.set(false); await chats.set( await getChatList(localStorage.token, 0, $pageSkip * $pageLimit || $pageLimit) ); await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned')); } - tagView.set(false); }; onMount(async () => {