fix: add null checks to chat iterators in ArchivedChats and FolderPlaceholder (#19898)

This commit is contained in:
G30 authored and GitHub committed 2025-12-11 20:34:39 -05:00
1 parent 8e661a4e73
commit 18e6cfb1fd
2 files changed
+17 -13

No files matched your search

@@ -1,6 +1,8 @@
<script>
<script lang="ts">
import { getContext, onMount } from 'svelte';
const i18n = getContext('i18n');
import type { Writable } from 'svelte/store';
const i18n: Writable<any> = getContext('i18n');
import { fade } from 'svelte/transition';
@@ -9,13 +11,13 @@
import Spinner from '$lib/components/common/Spinner.svelte';
import { getChatListByFolderId } from '$lib/apis/chats';
export let folder = null;
export let folder: any = null;
let selectedTab = 'chats';
let page = 1;
let chats = null;
let chats: any[] | null = null;
let chatListLoading = false;
let allChatsLoaded = false;
@@ -24,7 +26,7 @@
page += 1;
let newChatList = [];
let newChatList: any[] = [];
newChatList = await getChatListByFolderId(localStorage.token, folder.id, page).catch(
(error) => {
@@ -35,7 +37,7 @@
// once the bottom of the list has been reached (no results) there is no need to continue querying
allChatsLoaded = newChatList.length === 0;
chats = [...chats, ...newChatList];
chats = [...(chats || []), ...(newChatList || [])];
chatListLoading = false;
};