So, I have this inputfield, when you type something in it, it makes an API call to our backend, the problem I have is:
Let's say we are typing test, I will make 4 calls out of this:
- t
- te
- tes
- test
because the call for 't' takes much longer than 'test', the data from 't' will be loaded in at the end. which means I don't get the requested data from 'test'.
My question is, is there any way you can cancel the previous request? ('t', 'te', 'tes') and only let your last call get through? Or is this just optimizing performance of the API speed?
I've already tried with a timeout of half a second but the problem still remains sometimes.
the order the async results resolve may not be the order the user gave the inputs