We are using remote filtering and sorting on our AjaxStore and we are seeing a poor API and user experience because every event triggers a new network request. For example, a user will type a string into the filter and each character will launch an API request. The result is the user will get out of order responses resulting in older requests overwriting newer requests.
This is especially frustrating for our users because their filters behaving unpredictably and it is putting unnecessary strain on our API because it dramatically increases the number of API requests.
We would like to add a debounce on these requests until the user stops typing. We have tried adding a buffer to the beforeRequest event, but it merely puts a buffer on the anonymous function we pass it instead of the actual network requests.
Do you have any suggestions on how to accomplish this? Our only thought is to drop the AjaxStore entirely and write our own wrapper around the regular Store.
Example Code:
this.ajaxStore.on(
{
beforeRequest: () => console.log("before request fired"),
buffer: 2000
}
);