From: Stephen Smith Date: Fri, 21 Oct 2022 18:33:02 +0000 (-0400) Subject: 16073: Avoid applying empty inputs when existing inputs already loaded X-Git-Tag: 2.5.0~31^2~4 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/9310afc8e2fbfcf17ef46cb4976b47d93bb99bb6 16073: Avoid applying empty inputs when existing inputs already loaded Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- diff --git a/src/views/process-panel/process-panel-root.tsx b/src/views/process-panel/process-panel-root.tsx index 248c5215..6b88e261 100644 --- a/src/views/process-panel/process-panel-root.tsx +++ b/src/views/process-panel/process-panel-root.tsx @@ -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]);