Skip to content

Commit d63aae3

Browse files
committed
Throttle submit instead of debounce
1 parent 152c274 commit d63aae3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/QueryEditor/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { css } from '@emotion/css';
22

33
import React, { createContext } from 'react';
4-
import { debounceTime } from 'rxjs';
4+
import { debounceTime, throttleTime } from 'rxjs';
55
import { useObservableCallback, useSubscription } from 'observable-hooks'
66

77
import { CoreApp, Field, getDefaultTimeRange, GrafanaTheme2, QueryEditorProps } from '@grafana/data';
@@ -100,7 +100,7 @@ const QueryEditorForm = ({ value, onRunQuery }: Props) => {
100100
}
101101

102102
const [onChangeCB, textChanged$] = useObservableCallback<string>(event$ => event$.pipe(debounceTime(1000)))
103-
const [onSubmitCB, submitted$] = useObservableCallback<string>(event$=>event$.pipe(debounceTime(500)))
103+
const [onSubmitCB, submitted$] = useObservableCallback<string>(event$=>event$.pipe(throttleTime(500)))
104104

105105
useSubscription(textChanged$, onChange)
106106
useSubscription(submitted$, onSubmit)

0 commit comments

Comments
 (0)