diff --git a/src/components/TabsBar.vue b/src/components/TabsBar.vue index 2e56572eb..1681b5c57 100644 --- a/src/components/TabsBar.vue +++ b/src/components/TabsBar.vue @@ -30,7 +30,7 @@ @@ -42,7 +42,6 @@ {{ pages[index]?.name }} this.pages[page]); + } + }, watch: { openedPages: { handler(newVal) { this.localOpenedPages = newVal; }, deep: true + }, + pages: { + handler() { + this.localOpenedPages = this.localOpenedPages.filter( + (page) => this.pages[page] + ); + }, + deep: true } }, mounted() { @@ -189,9 +201,14 @@ export default { this.$emit("tab-closed", this.pages[pageId], this.localOpenedPages); }, updateTabsReferences(pageDelete) { - this.localOpenedPages = this.localOpenedPages.map((page) => page > pageDelete ? page - 1 : page); + this.localOpenedPages = this.localOpenedPages.map((page) => + page > pageDelete ? page - 1 : page + ); }, async openPageByIndex(index) { + if (index === -1) { + return; + } const n = this.localOpenedPages.indexOf(index * 1); if (n === -1) { this.localOpenedPages.push(index); diff --git a/src/components/vue-form-builder.vue b/src/components/vue-form-builder.vue index 179736eb5..750e4bf4c 100644 --- a/src/components/vue-form-builder.vue +++ b/src/components/vue-form-builder.vue @@ -117,7 +117,7 @@