From 0fa5a34abf8dcd40784c0a9e2f89ba01937af024 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 26 Apr 2022 11:13:44 -0400
Subject: from last

---
 src/client/views/DocumentDecorations.tsx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'src/client/views/DocumentDecorations.tsx')

diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 2914e5ad4..def2be848 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -151,11 +151,12 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number, P
         if (this.canDelete) {
             const views = SelectionManager.Views().slice().filter(v => v);
             if (force) this._deleteAfterIconify = true;
-            if (!this._iconifyBatch) this._iconifyBatch = UndoManager.StartBatch("iconifying");
-            else this._deleteAfterIconify = true;
-            this._iconifyingCount = views.length;
+            if (!this._iconifyBatch) {
+                this._iconifyBatch = UndoManager.StartBatch("iconifying");
+                this._iconifyingCount = force ? 1 : views.length;
+            } else this._deleteAfterIconify = true;
             const finished = () => {
-                if (this._deleteAfterIconify || --this._iconifyingCount <= 0) {
+                if (--this._iconifyingCount <= 0) {
                     this._iconifyingCount = 0;
                     SelectionManager.DeselectAll();
                     if (this._deleteAfterIconify) views.forEach(iconView => iconView.props.removeDocument?.(iconView.props.Document));
-- 
cgit v1.2.3-70-g09d2

