From 277498c09aa7fbbc5d45620b537f8ce972d42ba1 Mon Sep 17 00:00:00 2001 From: Marwan Zaarab Date: Fri, 5 Apr 2024 12:24:12 -0500 Subject: [PATCH] Prevent QuickPick on error in stacks, and utilize existing state rather than refetch --- src/views/statusBar/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/views/statusBar/index.ts b/src/views/statusBar/index.ts index d44becd2..c5a34901 100644 --- a/src/views/statusBar/index.ts +++ b/src/views/statusBar/index.ts @@ -15,6 +15,7 @@ import { getActiveStack, switchActiveStack } from '../../commands/stack/utils'; import { EventBus } from '../../services/EventBus'; import { LSP_ZENML_STACK_CHANGED, SERVER_STATUS_UPDATED } from '../../utils/constants'; import { StackDataProvider } from '../activityBar'; +import { ErrorTreeItem } from '../activityBar/common/ErrorTreeItem'; /** * Represents the ZenML extension's status bar. @@ -116,10 +117,12 @@ export default class ZenMLStatusBar { */ private async switchStack(): Promise { const stackDataProvider = StackDataProvider.getInstance(); - const stacks = await stackDataProvider.fetchStacksWithComponents(); + const { stacks } = stackDataProvider; - if (stacks.length === 0) { - window.showErrorMessage('No stacks found.'); + const containsErrors = stacks.some(stack => stack instanceof ErrorTreeItem); + + if (containsErrors || stacks.length === 0) { + window.showErrorMessage('No stacks available.'); return; }