X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/0eaad7ee985d2534e030e2d2839392435c33bba2..38d27e9783f7f760cee84cc225e86144069848c4:/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..543100db 100644
--- a/src/views/run-process-panel/inputs/string-input.tsx
+++ b/src/views/run-process-panel/inputs/string-input.tsx
@@ -2,11 +2,12 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import { isRequiredInput, StringCommandInputParameter } from '~/models/workflow';
+import React from 'react';
+import { memoize } from 'lodash/fp';
+import { isRequiredInput, StringCommandInputParameter } from 'models/workflow';
 import { Field } from 'redux-form';
-import { require } from '~/validators/require';
-import { GenericInputProps, GenericInput } from '~/views/run-process-panel/inputs/generic-input';
+import { require } from 'validators/require';
+import { GenericInputProps, GenericInput } from 'views/run-process-panel/inputs/generic-input';
 import { Input as MaterialInput } from '@material-ui/core';
 
 export interface StringInputProps {
@@ -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) =>
     <GenericInput
