[Datasource] Do not send "search" request each time user type to get autocomplete on options


First thanks for that awesome plugin https://github.com/grafana/simple-json-datasource it helped me to start writing a plugin for Grafana.

I am developing a separate datasource and I saw that on both on them, when the user types in the gf-form-dropdown to get autocomplete, it sends a “search” request each time the user type something.
As my API is a bit slow, if the user types too much, then requests starts to stack and each time propose completion and it’s a bit of a pain.

Is it possible to send the search request only once when the user click on the dropdown and do the autocomplete on that only search request ?
That way it would reduce the load on the API I am querying.

Many thanks in advance.

I think it’s related to that issue : https://github.com/grafana/grafana/issues/1926

To answer my own question, you have to implement a caching system like those guys : https://github.com/cognitedata/cognite-grafana-datasource/blob/master/src/cache.ts

Topic closed :slight_smile: