Can we have a ‘onprogress’ event when making calls to the server? This will make it possible to show something like a loading bar that will tell the progress of the call to users. Currently, it is possible if you make an XMLHttpRequest to an HTTP endpoint. Any chance we can have it when calling the anvil.server.call function?
Clone link demonstrating an example with an HTTP endpoint.
https://anvil.works/build#clone:OM7743KJLNPEQVBD=YEYEPZ5PCA5WUOXXAVK47I4G
The code in the form will wait for the server call to be done before continuing the execution. If the server takes longer than 30 seconds it will timeout and crash.
If you need longer jobs, you should call the server function, the server function should start a background job and immediately return control to the form. Add a timer on the form that every second will call a second server function that checks the status of the background job and returns it to the client, so the form can show the progress.
This was not my question. Here, I was talking about the onprogress event which is available when making AJAX calls. Since Anvil also makes AJAX calls for communicating with the server, this event can be added.
You can check out my Clone link to know more about what I was talking about.