diff --git a/frontend/src/components/dashboard/AiInstanceTabs.vue b/frontend/src/components/dashboard/AiInstanceTabs.vue index dcec71b..3c4532d 100644 --- a/frontend/src/components/dashboard/AiInstanceTabs.vue +++ b/frontend/src/components/dashboard/AiInstanceTabs.vue @@ -4,6 +4,7 @@ import AiInstanceComponent from '@/components/dashboard/AiInstanceComponent.vue' import Alert from '@/components/Bootstrap/Alert.vue'; import {AiInstanceVmV1} from 'ai-oas'; import {AiInstanceStore} from '@/stores/AiInstanceStore'; +import {Watch} from 'vue-property-decorator'; @Options({ name: 'AiInstanceTabs', @@ -16,6 +17,13 @@ export default class AiInstanceTabs extends Vue { mounted(): void { this.aiInstanceStore.loadIfAbsent(); } + + @Watch('aiInstanceStore.aiInstances', {deep: true}) + private onAiInstancesChanged(newValue: AiInstanceVmV1[]): void { + if (this.selectedAiInstance && !newValue.find(e => e === this.selectedAiInstance)) { + this.selectedAiInstance = newValue.find(e => e.configuration.id === this.selectedAiInstance?.configuration.id) ?? null; + } + } }