From 7035e2e6bdcb3efbfa3a4eca887b41eba87e6d6e Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 23 Feb 2021 01:53:52 -0500
Subject: fixed backspace to delete text items in treeViews.  simplified
 UndoRunInTempBatch.  fixed clicking on sort line for treeView to only
 recognize actual clicks.  fixed stayInCollection with DocDecorations to not
 create a giant gray square.  prevent server crash when db has bad data
 somehow.

---
 src/client/views/collections/CollectionView.tsx | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

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

diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 9ae469930..f305174f1 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -211,14 +211,7 @@ export class CollectionView extends Touchable<CollectionViewProps> {
         }
         const first = doc instanceof Doc ? doc : doc[0];
         if (!first?._stayInCollection && addDocument !== returnFalse) {
-            if (UndoManager.RunInTempBatch(() => this.removeDocument(doc))) {
-                const added = addDocument(doc);
-                if (!added) UndoManager.UndoTempBatch();
-                else UndoManager.ClearTempBatch();
-
-                return added;
-            }
-            UndoManager.ClearTempBatch();
+            return UndoManager.RunInTempBatch(() => this.removeDocument(doc) && addDocument(doc));
         }
         return false;
     }
-- 
cgit v1.2.3-70-g09d2

