From f3f9a6e0b7f2cd1f3bd8ead764bce69a3ebfbe6d Mon Sep 17 00:00:00 2001 From: lyon Date: Wed, 17 Jun 2026 09:41:11 +0800 Subject: [PATCH] fix(v03): show workbench loading during session hydrate --- web/hwlab-cloud-web/src/stores/workbench.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/hwlab-cloud-web/src/stores/workbench.ts b/web/hwlab-cloud-web/src/stores/workbench.ts index 5c2f1168..cbec4a71 100644 --- a/web/hwlab-cloud-web/src/stores/workbench.ts +++ b/web/hwlab-cloud-web/src/stores/workbench.ts @@ -50,7 +50,7 @@ export const useWorkbenchStore = defineStore("workbench", () => { const activeConversation = computed(() => visibleConversations.value.find((item) => item.conversationId === activeConversationId.value) ?? null); const sessionTabs = computed(() => sortSessionTabs(visibleConversations.value, activeConversationId.value, sessionStatusAuthority.value)); const sessionListLoading = computed(() => shouldShowSessionListLoading({ loading: loading.value, conversationsReady: conversationsReady.value })); - const conversationDetailLoading = computed(() => Boolean(conversationDetailLoadingId.value || switchingConversationId.value)); + const conversationDetailLoading = computed(() => Boolean(conversationDetailLoadingId.value || switchingConversationId.value || (loading.value && messages.value.length === 0))); const activeProjectId = computed(() => workspaceProjectId(workspace.value, projectId.value)); const composer = computed(() => resolveComposerState({ workspace: workspace.value, messages: messages.value, conversations: visibleConversations.value, activeConversationId: activeConversationId.value, chatPending: chatPending.value, currentRequest: currentRequest.value, turnStatusAuthority: turnStatusAuthority.value })); @@ -62,11 +62,14 @@ export const useWorkbenchStore = defineStore("workbench", () => { async function hydrate(options: HydrateOptions = {}): Promise { const requestEpoch = workspaceSelectionEpoch.value; const previousConversationId = activeConversationId.value; + const routeConversationId = normalizeWorkbenchConversationId(options.conversationId); + if (routeConversationId) conversationDetailLoadingId.value = routeConversationId; conversationsReady.value = conversations.value.length > 0; loading.value = true; error.value = null; const workspaceResult = await api.workbench.workspace(projectId.value); if (!workspaceResult.ok) { + clearConversationDetailLoading(routeConversationId); loading.value = false; error.value = workspaceResult.error ?? "workspace unavailable"; return; @@ -74,7 +77,6 @@ export const useWorkbenchStore = defineStore("workbench", () => { const nextWorkspace = workspaceResult.data?.workspace ?? null; const nextProjectId = workspaceProjectId(nextWorkspace, projectId.value); projectId.value = nextProjectId; - const routeConversationId = normalizeWorkbenchConversationId(options.conversationId); const selectedConversationId = routeConversationId ?? selectedConversationIdFromWorkspace(nextWorkspace); const conversationsPromise = api.workbench.conversations(nextProjectId, { includeConversationId: selectedConversationId }); if (selectedConversationId) conversationDetailLoadingId.value = selectedConversationId;