Merge pull request #1373 from pikasTech/fix/issue1368-loading-hydrate
fix(v03): show workbench loading during session hydrate
This commit is contained in:
@@ -50,7 +50,7 @@ export const useWorkbenchStore = defineStore("workbench", () => {
|
|||||||
const activeConversation = computed(() => visibleConversations.value.find((item) => item.conversationId === activeConversationId.value) ?? null);
|
const activeConversation = computed(() => visibleConversations.value.find((item) => item.conversationId === activeConversationId.value) ?? null);
|
||||||
const sessionTabs = computed(() => sortSessionTabs(visibleConversations.value, activeConversationId.value, sessionStatusAuthority.value));
|
const sessionTabs = computed(() => sortSessionTabs(visibleConversations.value, activeConversationId.value, sessionStatusAuthority.value));
|
||||||
const sessionListLoading = computed(() => shouldShowSessionListLoading({ loading: loading.value, conversationsReady: conversationsReady.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 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 }));
|
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<void> {
|
async function hydrate(options: HydrateOptions = {}): Promise<void> {
|
||||||
const requestEpoch = workspaceSelectionEpoch.value;
|
const requestEpoch = workspaceSelectionEpoch.value;
|
||||||
const previousConversationId = activeConversationId.value;
|
const previousConversationId = activeConversationId.value;
|
||||||
|
const routeConversationId = normalizeWorkbenchConversationId(options.conversationId);
|
||||||
|
if (routeConversationId) conversationDetailLoadingId.value = routeConversationId;
|
||||||
conversationsReady.value = conversations.value.length > 0;
|
conversationsReady.value = conversations.value.length > 0;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
error.value = null;
|
error.value = null;
|
||||||
const workspaceResult = await api.workbench.workspace(projectId.value);
|
const workspaceResult = await api.workbench.workspace(projectId.value);
|
||||||
if (!workspaceResult.ok) {
|
if (!workspaceResult.ok) {
|
||||||
|
clearConversationDetailLoading(routeConversationId);
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
error.value = workspaceResult.error ?? "workspace unavailable";
|
error.value = workspaceResult.error ?? "workspace unavailable";
|
||||||
return;
|
return;
|
||||||
@@ -74,7 +77,6 @@ export const useWorkbenchStore = defineStore("workbench", () => {
|
|||||||
const nextWorkspace = workspaceResult.data?.workspace ?? null;
|
const nextWorkspace = workspaceResult.data?.workspace ?? null;
|
||||||
const nextProjectId = workspaceProjectId(nextWorkspace, projectId.value);
|
const nextProjectId = workspaceProjectId(nextWorkspace, projectId.value);
|
||||||
projectId.value = nextProjectId;
|
projectId.value = nextProjectId;
|
||||||
const routeConversationId = normalizeWorkbenchConversationId(options.conversationId);
|
|
||||||
const selectedConversationId = routeConversationId ?? selectedConversationIdFromWorkspace(nextWorkspace);
|
const selectedConversationId = routeConversationId ?? selectedConversationIdFromWorkspace(nextWorkspace);
|
||||||
const conversationsPromise = api.workbench.conversations(nextProjectId, { includeConversationId: selectedConversationId });
|
const conversationsPromise = api.workbench.conversations(nextProjectId, { includeConversationId: selectedConversationId });
|
||||||
if (selectedConversationId) conversationDetailLoadingId.value = selectedConversationId;
|
if (selectedConversationId) conversationDetailLoadingId.value = selectedConversationId;
|
||||||
|
|||||||
Reference in New Issue
Block a user