From 59678e34dad0b6587f28ec642c84f6c6ee06543b Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Sun, 11 May 2025 02:08:38 -0400
Subject: firefly templates correctly loading

---
 .../DocCreatorMenu/Menu/TemplateEditingWindow.tsx          | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

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

diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplateEditingWindow.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplateEditingWindow.tsx
index f34b7efcf..fa84616cc 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplateEditingWindow.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplateEditingWindow.tsx
@@ -75,10 +75,11 @@ export class TemplateEditingWindow extends ObservableReactComponent<TemplateEdit
                 <TemplatePreviewGrid
                     menu={this._props.menu}
                     title={'Generate Variations'}
+                    loading={this._loading}
                     templates={this._props.menu._variations}
                     optionsButtonOpts={['gear', this.func]}
                     setupButtonClick={this._props.setupButtonClick}
-                    previewBoxRightButtonOpts={['gear', (component: ObservableReactComponent<TemplatePreviewBoxProps>) => {component.forceUpdate();}]}
+                    previewBoxRightButtonOpts={['gear', (template: Template) => {this.forceUpdate();}]}
                 />
                 <div className="docCreatorMenu-section">
                     <div className="docCreatorMenu-variation-prompt-input">
@@ -93,18 +94,17 @@ export class TemplateEditingWindow extends ObservableReactComponent<TemplateEdit
                                 this._props.menu._variations = [];
                                 this._loading = true;
                                 this._variationURLs = await this._props.menu.generateVariations(this._props.template.getRenderedDoc()!, this.fireflyPrompt);
-                                const templates: Template[] = [];
                                 this._variationURLs.forEach(url => {
                                     const newTemplate: Template = this._props.template.cloneBase();
-                                    newTemplate.setImageAsBackground(url, true);
-                                    templates.push(newTemplate);
+                                    this._props.menu._variations.push(newTemplate);
                                 });
                                 this._loading = false;
                                 setTimeout(() => {
-                                    console.log('setting')
-                                    this._props.menu._variations = templates;
+                                    this._variationURLs.forEach((url, i) => {
+                                        this._props.menu._variations[i].setImageAsBackground(url, true);
+                                    });
                                     this.forceUpdate();
-                                }, 1000);
+                                });
                             })
                         }>
                             <FontAwesomeIcon icon="arrows-rotate" />
-- 
cgit v1.2.3-70-g09d2

