As for axios to cancel all requests, except the last one?

Good afternoon. There is a component for vue autocomplete. Each time you press the query string sent to the server. Accordingly, a situation arises when simultaneously there is a lot of requests to the server, although, in fact, need only the last. How to implement it?
March 19th 20 at 08:26
3 answers
March 19th 20 at 08:28
Solution
You need a debounce
March 19th 20 at 08:30
not on keyup or similar events to call the method, and on submit, for example
The logic component unfortunately can not be changed, if only it were that simple, I wouldn't worry. - Daren_Runte76 commented on March 19th 20 at 08:33
March 19th 20 at 08:32
debounce in the lodash package to help you :) https://lodash.com/

Find more questions by tags Vue.js