Speed Up Web Apps

PSA — Not everything needs to wait for AJAX.


The premise here is that not everything has to wait for an ajax call. Let the browser return quicker, and then just alert any errors.

Example, you make a save, then a publish to a web service. Break that into 2 parts, save first, then publish in another ajax, call. But return after the first. Just let the user know if there was an error.

If the thing doesn't DEPEND on the answer, then it doesn't need to be UI blocking. DEPENDS as in, needs an ID from.

Ajax is great, we've had it for so long, at this point it’s old. (Enter websocket data streaming!) But there is a big UX problem that ajax seems to create. Let’s say you’re writing a blog tool. When the user saves the blog, you would pop up a saving dialog. Well that’s actually a big problem. Why should the user have to wait for the save? The user is ready to move on, and do something else.

A lot of applications are getting this right though. They will save the blog in the background and let you navigate to the intended page. Even if that intended page had a list of blogs, when the blog has saved, the list is then updated. It is technically much easier to have the ID and the model for that new blog before you leave, but it’s not a better experience. If you’re using any kind of template rendering, then this actually should be really simple to implement. Just re-render the list template when you receive the finish of the save.

User experience is starting to get a lot better. The onset of web components let’s us have complex buttons and controls that are much more descriptive than ever before. Google’s new material design buttons are a great example of this https://www.polymer-project.org/components/paper-button/demo.html. And if these were built as web components these would be too.

With that, let’s stop having ajax calls be UI blocking.

I make youtube videos teaching other programmers how to do my job. Check it out https://www.youtube.com/user/optikalefxx