Fix delChat sorting

This commit is contained in:
2025-07-07 02:39:41 +09:00
parent cde826eb4a
commit eacc0123c6

View File

@@ -19,6 +19,7 @@
} from '@fortawesome/free-solid-svg-icons/index' } from '@fortawesome/free-solid-svg-icons/index'
import { faSquareMinus, faSquarePlus as faSquarePlusOutline } from '@fortawesome/free-regular-svg-icons/index' import { faSquareMinus, faSquarePlus as faSquarePlusOutline } from '@fortawesome/free-regular-svg-icons/index'
import { addChatFromJSON, chatsStorage, checkStateChange, clearChats, clearMessages, copyChat, globalStorage, setGlobalSettingValueByKey, showSetChatSettings, pinMainMenu, getChat, deleteChat, saveChatStore, saveCustomProfile } from './Storage.svelte' import { addChatFromJSON, chatsStorage, checkStateChange, clearChats, clearMessages, copyChat, globalStorage, setGlobalSettingValueByKey, showSetChatSettings, pinMainMenu, getChat, deleteChat, saveChatStore, saveCustomProfile } from './Storage.svelte'
import { getChatSortOption } from './Storage.svelte'
import { exportAsMarkdown, exportChatAsJSON } from './Export.svelte' import { exportAsMarkdown, exportChatAsJSON } from './Export.svelte'
import { newNameForProfile, restartProfile } from './Profiles.svelte' import { newNameForProfile, restartProfile } from './Profiles.svelte'
import { replace } from 'svelte-spa-router' import { replace } from 'svelte-spa-router'
@@ -36,7 +37,12 @@
} }
export let style: string = 'is-right' export let style: string = 'is-right'
$: sortedChats = $chatsStorage.sort((a, b) => b.id - a.id) let sortedChats = []
$: {
const currentSortOption = getChatSortOption()
sortedChats = [...$chatsStorage].sort(currentSortOption.sortFn)
}
let showChatMenu = false let showChatMenu = false
let chatFileInput let chatFileInput