Debounce searches

Debounce searches

By default this component will fire the search event with each change on the search term but very often you want to debounce searches to not overload the server, hit API rate limits or make the UI smoother.

You can do that yourself with a few lines of code:

That way you are in control and you can vary the debounce intervals depending on any custom logic like the device (people type slower in small screens), make it bigger if the API tells that you're approaching the API rate limit.

It makes you code a little more but in exchange you always have the ultimate decision.

Debouncing searches with ember-concurrency

Ember Power Select uses ember-concurrency internally to manage asyncrony in a nice way, and so can you. The above example can be expresed much more succint way using ember-concurrency's task because it abstract you from all the manual bookeeping of promises and debounce times.

That's it. Three lines of code for debounced searches with automatic cancellation.