Skip to content

Commit

Permalink
Change EuiFieldSearch to use onChange instead of onSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
simianhacker committed Apr 28, 2020
1 parent c3e2765 commit 0db04a7
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React, { useCallback, useMemo, useEffect, useState } from 'react';
import React, { ChangeEvent, useCallback, useMemo, useEffect, useState } from 'react';
import {
EuiFlexGroup,
EuiFlexItem,
Expand Down Expand Up @@ -225,6 +225,11 @@ export const Expressions: React.FC<Props> = props => {
}
}, [alertsContext.metadata, defaultExpression, source]); // eslint-disable-line react-hooks/exhaustive-deps

const handleFieldSearchChange = useCallback(
(e: ChangeEvent<HTMLInputElement>) => onFilterQuerySubmit(e.target.value),
[onFilterQuerySubmit]
);

return (
<>
<EuiSpacer size={'m'} />
Expand Down Expand Up @@ -297,7 +302,7 @@ export const Expressions: React.FC<Props> = props => {
/>
)) || (
<EuiFieldSearch
onSearch={onFilterQuerySubmit}
onChange={handleFieldSearchChange}
value={alertParams.filterQuery}
fullWidth
/>
Expand Down

0 comments on commit 0db04a7

Please sign in to comment.