Skip to content

Commit

Permalink
Prevent QuickPick on error in stacks, and utilize existing state rath…
Browse files Browse the repository at this point in the history
…er than refetch
  • Loading branch information
marwan37 committed Apr 5, 2024
1 parent 631b194 commit 277498c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/views/statusBar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -116,10 +117,12 @@ export default class ZenMLStatusBar {
*/
private async switchStack(): Promise<void> {
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;
}

Expand Down

0 comments on commit 277498c

Please sign in to comment.