Say I have a function render which runs client side, and can take 100-1000ms And I have a function fetch that makes a server request and on success, clears timeout for render and then calls render with a timeout of 100ms. And I have a button, which onclick, again, clears the timeout for render and then calls render with a timeout of 100ms.
I've found when I try to click the button many times and also if many server requests had been made, only the first and last response cause render, as expected. But is this guaranteed? Can I safely rely on this?
Any links that reassure me or tell me about gotchas will be appreciated. I've been through this I understand that whatever be the case, if any asyc event occurs, it will be queued and executed only the first time execution goes idle, but I'm confused about the decision about what should be in the queue since that's done by the browser?