Skip to content

Commit 0cdddc2

Browse files
committed
handle last block closure => call through to give the close tab dialog
1 parent f874888 commit 0cdddc2

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

frontend/app/store/keymodel.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ function uxCloseBlock(blockId: string) {
160160
const blockData = globalStore.get(blockAtom);
161161
const isAIFileDiff = blockData?.meta?.view === "aifilediff";
162162

163+
// If this is the last block, closing it will close the tab — route through simpleCloseStaticTab
164+
// so the tab:confirmclose setting is respected.
165+
if (getStaticTabBlockCount() === 1) {
166+
simpleCloseStaticTab();
167+
return;
168+
}
169+
163170
const layoutModel = getLayoutModelForStaticTab();
164171
const node = layoutModel.getNodeByBlockId(blockId);
165172
if (node) {
@@ -199,6 +206,13 @@ function genericClose() {
199206
return;
200207
}
201208

209+
// If this is the last block, closing it will close the tab — route through simpleCloseStaticTab
210+
// so the tab:confirmclose setting is respected.
211+
if (blockCount === 1) {
212+
simpleCloseStaticTab();
213+
return;
214+
}
215+
202216
const layoutModel = getLayoutModelForStaticTab();
203217
const focusedNode = globalStore.get(layoutModel.focusedNode);
204218
const blockId = focusedNode?.data?.blockId;

0 commit comments

Comments
 (0)