16073: Avoid applying empty inputs when existing inputs already loaded
[arvados-workbench2.git] / 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]);