From f8c2d9d029f129eb595677b1e8a09ff1ebd5880c Mon Sep 17 00:00:00 2001
From: Sophie Zhang <sophie_zhang@brown.edu>
Date: Wed, 23 Aug 2023 23:07:18 -0400
Subject: branching fix

---
 src/client/views/nodes/generativeFill/GenerativeFill.tsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/client/views/nodes/generativeFill/GenerativeFill.tsx')

diff --git a/src/client/views/nodes/generativeFill/GenerativeFill.tsx b/src/client/views/nodes/generativeFill/GenerativeFill.tsx
index ce6ce672f..7230aa9b1 100644
--- a/src/client/views/nodes/generativeFill/GenerativeFill.tsx
+++ b/src/client/views/nodes/generativeFill/GenerativeFill.tsx
@@ -181,6 +181,7 @@ const GenerativeFill = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addD
 
         // cleanup
         return () => {
+            setInput('');
             setEdited(false);
             newCollectionRef.current = null;
             parentDoc.current = null;
@@ -268,8 +269,8 @@ const GenerativeFill = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addD
             // create first image
             if (!newCollectionRef.current) {
                 if (!isNewCollection && imageRootDoc) {
-                    // new collection stays null
-                    parentDoc.current = imageRootDoc;
+                    // if the parent hasn't been set yet
+                    if (!parentDoc.current) parentDoc.current = imageRootDoc;
                 } else {
                     if (!(originalImg.current && imageRootDoc)) return;
                     // create new collection and add it to the view
-- 
cgit v1.2.3-70-g09d2

