X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/bde866ac574bdf34e17c1d8124f2dc36e854ad3c..58db72fee358d5987139a1b8526c0ca873e07dbf:/src/views/run-process-panel/inputs/float-input.tsx

diff --git a/src/views/run-process-panel/inputs/float-input.tsx b/src/views/run-process-panel/inputs/float-input.tsx
index 56a58012..14b06fd4 100644
--- a/src/views/run-process-panel/inputs/float-input.tsx
+++ b/src/views/run-process-panel/inputs/float-input.tsx
@@ -2,12 +2,13 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import { FloatCommandInputParameter, isRequiredInput } from '~/models/workflow';
+import React from 'react';
+import { memoize } from 'lodash/fp';
+import { FloatCommandInputParameter, isRequiredInput } from 'models/workflow';
 import { Field } from 'redux-form';
-import { isNumber } from '~/validators/is-number';
+import { isNumber } from 'validators/is-number';
 import { GenericInputProps, GenericInput } from './generic-input';
-import { FloatInput as FloatInputComponent } from '~/components/float-input/float-input';
+import { FloatInput as FloatInputComponent } from 'components/float-input/float-input';
 export interface FloatInputProps {
     input: FloatCommandInputParameter;
 }
@@ -17,11 +18,17 @@ export const FloatInput = ({ input }: FloatInputProps) =>
         commandInput={input}
         component={Input}
         parse={parseFloat}
-        format={value => isNaN(value) ? '' : JSON.stringify(value)}
-        validate={[
-            isRequiredInput(input)
-                ? isNumber
-                : () => undefined,]} />;
+        format={format}
+        validate={getValidation(input)} />;
+
+const format = (value: any) => isNaN(value) ? '' : JSON.stringify(value);
+
+const getValidation = memoize(
+    (input: FloatCommandInputParameter) => ([
+        isRequiredInput(input)
+            ? isNumber
+            : () => undefined,])
+);
 
 const Input = (props: GenericInputProps) =>
     <GenericInput
