X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/0eaad7ee985d2534e030e2d2839392435c33bba2..cc72c29b709759a4498ad232e3f0374e857c7a62:/src/views/run-process-panel/inputs/string-input.tsx diff --git a/src/views/run-process-panel/inputs/string-input.tsx b/src/views/run-process-panel/inputs/string-input.tsx index f6b50a7c..7fc74315 100644 --- a/src/views/run-process-panel/inputs/string-input.tsx +++ b/src/views/run-process-panel/inputs/string-input.tsx @@ -3,6 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; +import { memoize } from 'lodash/fp'; import { isRequiredInput, StringCommandInputParameter } from '~/models/workflow'; import { Field } from 'redux-form'; import { require } from '~/validators/require'; @@ -17,11 +18,14 @@ export const StringInput = ({ input }: StringInputProps) => name={input.id} commandInput={input} component={StringInputComponent} - validate={[ - isRequiredInput(input) - ? require - : () => undefined, - ]} />; + validate={getValidation(input)} />; + +const getValidation = memoize( + (input: StringCommandInputParameter) => ([ + isRequiredInput(input) + ? require + : () => undefined, + ])); const StringInputComponent = (props: GenericInputProps) =>