Plugins: automatically search plugins when typing in plugin list search box. (#36643)

* will automagically search if typing something in the search field.

* Decreasing the debounced time to 500ms
This commit is contained in:
Marcus Andersson 2021-07-16 12:43:13 +02:00 committed by GitHub
parent 11d03f7961
commit a6872deeb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ import React, { useState } from 'react';
import { css } from '@emotion/css';
import { useStyles2 } from '@grafana/ui';
import { GrafanaTheme2 } from '@grafana/data';
import { useDebounce } from 'react-use';
interface Props {
value?: string;
@ -12,6 +13,8 @@ export const SearchField = ({ value, onSearch }: Props) => {
const [query, setQuery] = useState(value);
const styles = useStyles2(getStyles);
useDebounce(() => onSearch(query ?? ''), 500, [query]);
return (
<input
value={query}