16073: Avoid applying empty inputs when existing inputs already loaded
authorStephen Smith <stephen@curii.com>
Fri, 21 Oct 2022 18:33:02 +0000 (14:33 -0400)
committerStephen Smith <stephen@curii.com>
Fri, 21 Oct 2022 18:33:02 +0000 (14:33 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/views/process-panel/process-panel-root.tsx

index 248c52158facf9c7076f6321b3a5168fa01abad3..6b88e2618622c41409ad185a93732746649c497d 100644 (file)
@@ -109,11 +109,15 @@ export const ProcessPanelRoot = withStyles(styles)(
     //   Can be sync because inputs are either already in containerRequest mounts or props
     React.useEffect(() => {
         if (containerRequest) {
-            const rawInputs = getRawInputs(containerRequest);
-            setInputs(rawInputs);
-
-            const inputs = getInputs(containerRequest);
-            setProcessedInputs(formatInputData(inputs, auth));
+            // Since mounts can disappear and reappear, only set inputs if raw / processed inputs is undefined or new inputs has content
+            const newRawInputs = getRawInputs(containerRequest);
+            if (rawInputs === undefined || newRawInputs && newRawInputs.length) {
+                setInputs(newRawInputs);
+            }
+            const newInputs = getInputs(containerRequest);
+            if (processedInputs === undefined || newInputs && newInputs.length) {
+                setProcessedInputs(formatInputData(newInputs, auth));
+            }
         }
     }, [requestUuid, auth, containerRequest]);