fix: add null checks to chat iterators in ArchivedChats and FolderPlaceholder (#19898)
This commit is contained in:
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;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user