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

This commit is contained in:
G30
2025-12-11 20:34:39 -05:00
committed by GitHub
parent 8e661a4e73
commit 18e6cfb1fd
2 changed files with 17 additions and 13 deletions
@@ -1,5 +1,7 @@
<script lang="ts">
// @ts-ignore
import fileSaver from 'file-saver';
import type { Writable } from 'svelte/store';
const { saveAs } = fileSaver;
import { toast } from 'svelte-sonner';
@@ -15,13 +17,13 @@
import UnarchiveAllConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
import Spinner from '../common/Spinner.svelte';
const i18n = getContext('i18n');
const i18n: Writable<any> = getContext('i18n');
export let show = false;
export let onUpdate = () => {};
let loading = false;
let chatList = null;
let chatList: any[] | null = null;
let page = 1;
let query = '';
@@ -30,13 +32,13 @@
let allChatsLoaded = false;
let chatListLoading = false;
let searchDebounceTimeout;
let searchDebounceTimeout: any;
let showUnarchiveAllConfirmDialog = false;
let filter = {};
let filter: any = {};
$: filter = {
...(query ? { query: query } : {}),
...(query ? { query } : {}),
...(orderBy ? { order_by: orderBy } : {}),
...(direction ? { direction } : {})
};
@@ -88,7 +90,7 @@
allChatsLoaded = newChatList.length === 0;
if (newChatList.length > 0) {
chatList = [...chatList, ...newChatList];
chatList = [...(chatList || []), ...newChatList];
}
chatListLoading = false;
@@ -102,7 +104,7 @@
saveAs(blob, `${$i18n.t('archived-chat-export')}-${Date.now()}.json`);
};
const unarchiveHandler = async (chatId) => {
const unarchiveHandler = async (chatId: string) => {
const res = await archiveChatById(localStorage.token, chatId).catch((error) => {
toast.error(`${error}`);
});