From a763c4e80cec6aef5219a8c9fcfa2ddccbc10b0a Mon Sep 17 00:00:00 2001
From: eleanor-park <eleanor_park@brown.edu>
Date: Wed, 24 Jul 2024 16:52:50 -0400
Subject: bug and render fixes

---
 .../collections/collectionFreeForm/CollectionFreeFormView.tsx  | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

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

diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index d0f65866b..f2b94fabc 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1312,7 +1312,7 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
             this._drawing.push(inkDoc);
             this.addDocument(inkDoc);
         });
-        const collection = containerDoc || this._marqueeViewRef.current?.collection(undefined, true, this._drawing);
+        const collection = this._marqueeViewRef.current?.collection(undefined, true, this._drawing);
         if (collection) {
             const docData = collection[DocData];
             docData.title = opts.text.match(/^(.*?)~~~.*$/)?.[1] || opts.text;
@@ -1329,14 +1329,14 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
     removeDrawing = (doc?: Doc) => {
         this._batch = UndoManager.StartBatch('regenerateDrawing');
         if (doc) {
-            const docData = DocCast(doc[DocData]);
+            const docData = doc[DocData];
             const children = DocListCast(docData.data);
+            this._props.removeDocument?.(doc);
             this._props.removeDocument?.(children);
-            // this._props.removeDocument?.(doc);
         } else {
-            this._props.removeDocument?.(this._drawing);
-            // if (this._drawingContainer) this._props.removeDocument?.(this._drawingContainer);
+            if (this._drawingContainer) this._props.removeDocument?.(this._drawingContainer);
         }
+        this._drawing = [];
     };
 
     @action
-- 
cgit v1.2.3-70-g09d2

