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 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<void> {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user