Skip to content

Commit

Permalink
Fix: need to keep track of onHead prior to calling CREATE_VIEW
Browse files Browse the repository at this point in the history
  • Loading branch information
jobelenus committed Dec 20, 2024
1 parent 144c726 commit 8b3caec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/web/src/components/LeftPanelDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ const create = async () => {
if (!viewName.value) {
labelRef.value?.setError("Name is required");
} else {
const onHead = changeSetsStore.headSelected;
// creating a view will force a changeset if you're on head
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;
// while awaiting CREATE_VIEW, the changeSet changes
// and the viewStore we _currently_ have is still the HEAD viewStore
// so we need to keep that in a variable
if (onHead) return;
if (resp.result.success) {
modalRef.value?.close();
viewStore.selectView(resp.result.data.id);
Expand Down

0 comments on commit 8b3caec

Please sign in to comment.