diff --git a/tools/ui/src/lib/stores/conversations/index.svelte.ts b/tools/ui/src/lib/stores/conversations/index.svelte.ts index 9b40c413fa..98bf6a0310 100644 --- a/tools/ui/src/lib/stores/conversations/index.svelte.ts +++ b/tools/ui/src/lib/stores/conversations/index.svelte.ts @@ -10,7 +10,6 @@ import { browser } from '$app/environment'; import { goto } from '$app/navigation'; import { ROUTES } from '$lib/constants'; -import { NEW_CHAT_TAB_ID } from '$lib/constants'; import { MessageRole } from '$lib/enums'; import { ConversationTransferService } from '$lib/services/conversation-transfer.service'; import { DatabaseService } from '$lib/services/database.service'; @@ -107,8 +106,8 @@ class ConversationsStore implements ConversationsPreferencesHost { /** * Deletes multiple conversations in sequence. - * Mirrors deleteConversation() per-id; navigates to NEW_CHAT only if the - * currently-open chat was among the deleted ones. + * Mirrors deleteConversation() per-id; navigates to the new-chat screen only + * if the currently-open chat was among the deleted ones. * @param convIds - Conversation IDs to delete */ async bulkDeleteConversations(convIds: string[]): Promise { @@ -590,11 +589,9 @@ class ConversationsStore implements ConversationsPreferencesHost { * Start a fresh chat by navigating to the bare `#/` new-chat screen. The * chat layout opens a new-chat tab for it when Conversation tabs are on. */ - async openNewChat(): Promise { + async openNewChat(): Promise { this.clearActiveConversation(); await goto(ROUTES.START); - - return NEW_CHAT_TAB_ID; } /** diff --git a/tools/ui/src/lib/stores/init.ts b/tools/ui/src/lib/stores/init.ts index 46d64893ca..37ea87b17c 100644 --- a/tools/ui/src/lib/stores/init.ts +++ b/tools/ui/src/lib/stores/init.ts @@ -20,10 +20,12 @@ export function initStores(): Promise { permissionsStore.initialize(); toolsStore.initialize(); void versionStore.initialize(); - await conversationsStore.initialize(); - // prune persisted tabs against the loaded conversation list - tabsStore.init(conversationsStore.conversations.map((c) => c.id)); + // the full conversation list loads in the background; once it is back, + // prune persisted tabs against the conversations that still exist + void conversationsStore.initialize().then(() => { + tabsStore.init(conversationsStore.conversations.map((c) => c.id)); + }); })(); return startup;