How to cancel / ignore slow server calls

Is it possible to cancel or ignore the result of a server call when a new one is started?

For example, when the user clicks on one item in a repeating panel, a server call that gathers data to show on a detail form starts and works for 3 seconds. If the user then clicks on another item before the end of the 3 seconds, Anvil will wait for the first call to finish, update the form, start the second call and wait 3 more seconds.

Instead I would like to immediately start the new server call instead of waiting for the previous one to be finished.

Hi @stefano.menci, I have the same issue. Do you find a way to overcome the matter?

I don’t have one solution for all the cases. Depending on the situation I use different tricks.

Sometimes I work on the UI and disable all the links preventing the user from wildly clicking on other links before the first request has finished its job.

Other times it helps using a timer on the form to queue the requests to the server rather than sending them directly. That is, instead of sending the request to the server, I set the timer’s interval to 0.5 so the request will be sent by the tick event of the timer after 0.5 seconds.

Thanks so much for your advice