Fix metric picker query update
This commit is contained in:
@@ -73,6 +73,13 @@ export const MetricPicker = ({ value, options, isLoading, width, onChange }: Pro
|
|||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onBlurInternal = () => {
|
||||||
|
if (!isOpen) {
|
||||||
|
// Only call if menu isn't opened
|
||||||
|
onChange(query);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const onKeyDown = (e: React.KeyboardEvent) => {
|
const onKeyDown = (e: React.KeyboardEvent) => {
|
||||||
if (e.key === 'ArrowDown') {
|
if (e.key === 'ArrowDown') {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
@@ -105,7 +112,7 @@ export const MetricPicker = ({ value, options, isLoading, width, onChange }: Pro
|
|||||||
value={query}
|
value={query}
|
||||||
type="text"
|
type="text"
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
onBlur={() => onChange(query)}
|
onBlur={onBlurInternal}
|
||||||
onMouseDown={onOpen}
|
onMouseDown={onOpen}
|
||||||
suffix={isLoading && <Spinner />}
|
suffix={isLoading && <Spinner />}
|
||||||
width={width}
|
width={width}
|
||||||
|
|||||||
Reference in New Issue
Block a user