From e5ed45fb20b7f23e8cf69672665dc6d22883b2a4 Mon Sep 17 00:00:00 2001 From: G30 <50341825+silentoplayz@users.noreply.github.com> Date: Tue, 16 Jun 2026 18:26:35 -0400 Subject: [PATCH] fix(ui): handle null chat in folder drop handler for cross-account drag (#25928) --- .../layout/Sidebar/RecursiveFolder.svelte | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/lib/components/layout/Sidebar/RecursiveFolder.svelte b/src/lib/components/layout/Sidebar/RecursiveFolder.svelte index 0523de415e..d2259d2578 100644 --- a/src/lib/components/layout/Sidebar/RecursiveFolder.svelte +++ b/src/lib/components/layout/Sidebar/RecursiveFolder.svelte @@ -176,24 +176,26 @@ }); } - // Move the chat - const res = await updateChatFolderIdById( - localStorage.token, - chat.id, - folderId - ).catch((error) => { - toast.error(`${error}`); - return null; - }); + if (chat) { + // Move the chat + const res = await updateChatFolderIdById( + localStorage.token, + chat.id, + folderId + ).catch((error) => { + toast.error(`${error}`); + return null; + }); - onItemMove({ - originFolderId: chat.folder_id, - targetFolderId: folderId, - e - }); + onItemMove({ + originFolderId: chat.folder_id, + targetFolderId: folderId, + e + }); - if (res) { - dispatch('update'); + if (res) { + dispatch('update'); + } } } } catch (error) {