We are discussing in our team how best to handle UI updates after a user does something to cause an AJAX request to the server.
Here are options we are considering:
- Instantly update the UI and add/update/remove the item that has been changed, even though we don't have a success response from the server yet. We would show an error dialog if the AJAX request failed.
- Change the object and show an "updating" state.
- Only update the UI when the server actually has returned a success response.
In all 3 cases we would indicate that the application is still busy with the request whilst the AJAX request was still being processed.
Maybe this depends on the action that is being performed and how important it is. How important is it to be consistent with these approaches?