From a9e998f9e4e0fc8cec8e61d9e65f24c33bb81f4e Mon Sep 17 00:00:00 2001 From: Victor Wads Date: Mon, 17 Aug 2026 20:20:23 -0300 Subject: [PATCH] fix(app): keep the last document tab closable --- CHANGELOG.md | 1 + src/app/tabs/index.ts | 4 +++- src/components/TabBar.vue | 17 +++++++++++------ src/views/EditorView.vue | 2 +- tests/e2e/app/recent-files.spec.ts | 14 +++++++++++++- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c17614e6c..fb7e0f81f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ ### Changed +- Open new tabs on Recent Files so users can choose a document before creating a blank canvas. - Pan horizontally with Shift+wheel while preserving native horizontal trackpad movement. - Move MCP connections into their own Settings destination instead of presenting them as part of model configuration. diff --git a/src/app/tabs/index.ts b/src/app/tabs/index.ts index b66b3f30d..2122aea04 100644 --- a/src/app/tabs/index.ts +++ b/src/app/tabs/index.ts @@ -45,6 +45,7 @@ export const allTabs = computed(() => tabsRef.value.map((t) => ({ id: t.id, name: t.store.state.documentName, + isHome: t.showHome, isActive: t.id === activeTabId.value })) ) @@ -81,8 +82,9 @@ export function createTab(store?: EditorStore, initialGraph?: SceneGraph, showHo export function leaveHome(tabId: string): void { const tabIndex = tabsRef.value.findIndex((candidate) => candidate.id === tabId) + if (tabIndex === -1) return const tab = tabsRef.value[tabIndex] - if (!tab?.showHome) return + if (!tab.showHome) return tabsRef.value = tabsRef.value.with(tabIndex, { ...tab, showHome: false }) } diff --git a/src/components/TabBar.vue b/src/components/TabBar.vue index b66020998..bea5b7a64 100644 --- a/src/components/TabBar.vue +++ b/src/components/TabBar.vue @@ -19,6 +19,10 @@ const modelValue = computed({ set: (id: string) => switchTab(id) }) +function openRecentFilesTab() { + createTab(undefined, undefined, true) +} + function onMiddleClick(e: MouseEvent, tabId: string) { if (e.button === 1) { e.preventDefault() @@ -34,7 +38,7 @@ function onClose(e: MouseEvent, tabId: string) {