From 144c726e6671a247666aca2805b677f1f40f203b Mon Sep 17 00:00:00 2001 From: John Obelenus Date: Fri, 20 Dec 2024 18:34:24 -0500 Subject: [PATCH] dont try to do things on head --- app/web/src/components/LeftPanelDrawer.vue | 6 ++++++ app/web/src/store/views.store.ts | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/web/src/components/LeftPanelDrawer.vue b/app/web/src/components/LeftPanelDrawer.vue index e57c6a9cc4..aca5d9e402 100644 --- a/app/web/src/components/LeftPanelDrawer.vue +++ b/app/web/src/components/LeftPanelDrawer.vue @@ -80,9 +80,11 @@ import { } from "@si/vue-lib/design-system"; import SidebarSubpanelTitle from "@/components/SidebarSubpanelTitle.vue"; import { useViewsStore } from "@/store/views.store"; +import { useChangeSetsStore } from "@/store/change_sets.store"; import ViewCard from "./ViewCard.vue"; const viewStore = useViewsStore(); +const changeSetsStore = useChangeSetsStore(); const emit = defineEmits<{ (e: "closed"): void; @@ -117,6 +119,10 @@ const create = async () => { labelRef.value?.setError("Name is required"); } else { const resp = await viewStore.CREATE_VIEW(viewName.value); + // creating a view will force a changeset + // if you're on head don't try and select a new view + // because it happens on another changeset + if (changeSetsStore.headSelected) return; if (resp.result.success) { modalRef.value?.close(); viewStore.selectView(resp.result.data.id); diff --git a/app/web/src/store/views.store.ts b/app/web/src/store/views.store.ts index 19bc97ebb2..ae34195efc 100644 --- a/app/web/src/store/views.store.ts +++ b/app/web/src/store/views.store.ts @@ -760,11 +760,6 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => { method: "post", url: API_PREFIX, params: { name, clientUlid }, - onSuccess: (view) => { - const idx = this.viewList.findIndex((v) => v.name === name); - // confirming we dont already have the data - if (idx === -1) this.viewList.push(view); - }, }); }, async UPDATE_VIEW_NAME(view_id: ViewId, name: string) {