ui : don't block startup on the conversation list

- prune persisted tabs after the list loads in the background instead
  of awaiting it during init
- openNewChat now returns void; its return value was never read

Assisted-by: pi
This commit is contained in:
Aleksander Grygier
2026-08-21 19:04:52 +02:00
committed by GitHub
parent 890b459d23
commit 89776ebfb9
2 changed files with 8 additions and 9 deletions
@@ -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<void> {
@@ -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<string> {
async openNewChat(): Promise<void> {
this.clearActiveConversation();
await goto(ROUTES.START);
return NEW_CHAT_TAB_ID;
}
/**
+5 -3
View File
@@ -20,10 +20,12 @@ export function initStores(): Promise<void> {
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;