X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/ce23dccaf88e67b279c17ab2ce744f54536972f9..dbca22d752af6473a39e4f67c5fc0be355c80eaf:/src/views/run-process-panel/inputs/boolean-input.tsx

diff --git a/src/views/run-process-panel/inputs/boolean-input.tsx b/src/views/run-process-panel/inputs/boolean-input.tsx
index d3b93662..6a214e9d 100644
--- a/src/views/run-process-panel/inputs/boolean-input.tsx
+++ b/src/views/run-process-panel/inputs/boolean-input.tsx
@@ -3,6 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
+import { memoize } from 'lodash/fp';
 import { BooleanCommandInputParameter } from '~/models/workflow';
 import { Field } from 'redux-form';
 import { Switch } from '@material-ui/core';
@@ -26,9 +27,13 @@ const BooleanInputComponent = (props: GenericInputProps) =>
         component={Input}
         {...props} />;
 
-const Input = (props: GenericInputProps) =>
+const Input = ({ input, commandInput }: GenericInputProps) =>
     <Switch
         color='primary'
-        checked={props.input.value}
-        onChange={() => props.input.onChange(props.input.value)} 
-        disabled={props.commandInput.disabled} />;
\ No newline at end of file
+        checked={input.value}
+        onChange={handleChange(input.onChange, input.value)}
+        disabled={commandInput.disabled} />;
+
+const handleChange = memoize(
+    (onChange: (value: string) => void, value: string) => () => onChange(value)
+);
