Skip to content

Commit

Permalink
dont try to do things on head
Browse files Browse the repository at this point in the history
  • Loading branch information
jobelenus committed Dec 20, 2024
1 parent 301a35e commit 144c726
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 6 additions & 0 deletions app/web/src/components/LeftPanelDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 0 additions & 5 deletions app/web/src/store/views.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 144c726

Please sign in to comment.