From b1ec42d48e5430cdfe8e6397d500af31efc76893 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 21 Sep 2022 18:18:31 -0400
Subject: fixed issues with deleting  last stack, or deleting stacks and
 leaving only row/cols in goldenLayout

---
 src/client/views/collections/CollectionDockingView.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/client/views/collections/CollectionDockingView.tsx')

diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 25fe5fe43..c6ac5ee0c 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -477,6 +477,7 @@ export class CollectionDockingView extends CollectionSubView() {
     };
 
     stackCreated = (stack: any) => {
+        stack = stack.header ? stack : stack.origin;
         stack.header?.element.on('mousedown', (e: any) => {
             const dashboard = Doc.ActiveDashboard;
             if (dashboard && e.target === stack.header?.element[0] && e.button === 2) {
@@ -499,7 +500,7 @@ export class CollectionDockingView extends CollectionSubView() {
             .click(
                 action(() => {
                     //if (confirm('really close this?')) {
-                    if (!stack.parent.parent.isRoot || stack.parent.contentItems.length > 1) {
+                    if ((!stack.parent.isRoot && !stack.parent.parent.isRoot) || stack.parent.contentItems.length > 1) {
                         stack.remove();
                     } else {
                         alert('cant delete the last stack');
-- 
cgit v1.2.3-70-g09d2

