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:
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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…