From 73c480f06758dc7444e9456ad67144b5dcd057c2 Mon Sep 17 00:00:00 2001
From: Joe Farro <joe@jf.io>
Date: Fri, 15 Feb 2019 18:27:57 -0500
Subject: [PATCH] Fix JS errors on search form dropdowns (#325) (#329)

* Fix JS errors on search form dropdowns (#325)
* Fix formatting issue

Signed-off-by: Joe Farro <joef@uber.com>

Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
---
 .../__snapshots__/redux-form-field-adapter.test.js.snap    | 7 +++++--
 packages/jaeger-ui/src/utils/redux-form-field-adapter.js   | 6 ++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/packages/jaeger-ui/src/utils/__snapshots__/redux-form-field-adapter.test.js.snap b/packages/jaeger-ui/src/utils/__snapshots__/redux-form-field-adapter.test.js.snap
index a314a6b150..6cb85a9c35 100644
--- a/packages/jaeger-ui/src/utils/__snapshots__/redux-form-field-adapter.test.js.snap
+++ b/packages/jaeger-ui/src/utils/__snapshots__/redux-form-field-adapter.test.js.snap
@@ -10,9 +10,9 @@ exports[`reduxFormFieldAdapter not validated input should render as expected 1`]
       "error": null,
     }
   }
-  onBlur={null}
+  onBlur={[Function]}
   onChange={[Function]}
-  onFocus={null}
+  onFocus={[Function]}
   prefixCls="ant-input"
   type="text"
   value="inputValue"
@@ -46,6 +46,7 @@ exports[`reduxFormFieldAdapter validate input should render Popover as invisible
     }
     onBlur={[Function]}
     onChange={[Function]}
+    onFocus={[Function]}
     prefixCls="ant-input"
     type="text"
     value="inputValue"
@@ -80,6 +81,7 @@ exports[`reduxFormFieldAdapter validate input should render Popover as visible i
     }
     onBlur={[Function]}
     onChange={[Function]}
+    onFocus={[Function]}
     prefixCls="ant-input"
     type="text"
     value="inputValue"
@@ -109,6 +111,7 @@ exports[`reduxFormFieldAdapter validate input should render as expected when the
     }
     onBlur={[Function]}
     onChange={[Function]}
+    onFocus={[Function]}
     prefixCls="ant-input"
     type="text"
     value="inputValue"
diff --git a/packages/jaeger-ui/src/utils/redux-form-field-adapter.js b/packages/jaeger-ui/src/utils/redux-form-field-adapter.js
index e69399e212..34eab670b1 100644
--- a/packages/jaeger-ui/src/utils/redux-form-field-adapter.js
+++ b/packages/jaeger-ui/src/utils/redux-form-field-adapter.js
@@ -20,6 +20,8 @@ import * as React from 'react';
 
 import './redux-form-field-adapter.css';
 
+const noop = () => {};
+
 export default function reduxFormFieldAdapter({
   AntInputComponent,
   onChangeAdapter,
@@ -38,8 +40,8 @@ export default function reduxFormFieldAdapter({
           'is-invalid': isInvalid,
           'AdaptedReduxFormField--isValidatedInput': isValidatedInput,
         })}
-        onBlur={isValidatedInput ? onBlur : null}
-        onFocus={isValidatedInput ? onFocus : null}
+        onBlur={isValidatedInput && onBlur ? onBlur : noop}
+        onFocus={isValidatedInput && onFocus ? onFocus : noop}
         onChange={onChangeAdapter ? (...args) => onChange(onChangeAdapter(...args)) : onChange}
         value={value}
         {...rest}