From cd6459e5a8e0abb5aa196dc6627f6ed998b7012e Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Thu, 19 Dec 2024 05:42:58 -0500
Subject: same change for usertemplates

---
 .../views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx')

diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
index 505b7bd46..e1f53ec47 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
@@ -57,7 +57,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
     @observable _renderedDocCollection: Doc | undefined = undefined; // fullyRenderedDocs in a parent collection
     @observable _docsRendering: boolean = false; // dictates loading symbol
 
-    @observable _userTemplates: {template: Template, doc: Doc}[] = []; 
+    @observable _userTemplates: Template[] = []; 
     @observable _selectedTemplate: Template | undefined = undefined;
     @observable _currEditingTemplate: Template | undefined = undefined;
 
@@ -112,10 +112,10 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
         this._userCreatedFields = [];
     };
     @action addUserTemplate = (template: Template) => {
-        this._userTemplates.push({template: template.cloneBase(), doc: template.getRenderedDoc()});
+        this._userTemplates.push(template);
     };
     @action removeUserTemplate = (template: Template) => {
-        this._userTemplates = this._userTemplates.filter(info => info.template !== template);
+        this._userTemplates.splice(this._userTemplates.indexOf(t), 1);
     }
     @action setSuggestedTemplates = (templates: Template[]) => {
         this._suggestedTemplates = templates; //prettier-ignore
@@ -928,7 +928,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
                                     <FontAwesomeIcon icon="plus" color="rgb(160, 160, 160)" />
                                 </div>
                                 {this._userTemplates
-                                    .map(({template, doc}) => (
+                                    .map(template => (
                                         <div
                                             className="docCreatorMenu-preview-window"
                                             style={{
@@ -948,7 +948,7 @@ export class DocCreatorMenu extends ObservableReactComponent<FieldViewProps> {
                                             <button className="option-button right" onPointerDown={e => this.setUpButtonClick(e, () => this.removeUserTemplate(template))}>
                                                 <FontAwesomeIcon icon="minus" color="white" />
                                             </button>
-                                            {previewDoc(doc, template)}
+                                            {previewDoc(template.getRenderedDoc(), template)}
                                         </div>
                                     ))}
                             </div>
-- 
cgit v1.2.3-70-g09d2

