HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How to refresh user's content of the site after release?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
aftertheuserrefreshreleasesitehowcontent

Problem

I have an Angular / Web Api 2 site that uses ui-router for SPA behaviour and gulp for file transformations.

There is an issue where when I release the site, the user has to refresh their browser to view new content (usually). I have cache busting implemented on my js / css files, but it seems that the HTML views themselves are a problem. At the same time I can't help feel like I'm missing something blatantly obvious here.

How do I get my tech stack to refresh the user's content (eg. when adding a new field to an existing form) so that the user receives the most up to date version of the site after release?

Solution

Here is what works for us.

We have a "version" file deployed with the application itself. Then, application issues a "check version" request periodically that checks if the version that the application has initially loaded is different from the version specified in this version file. If it is different, we show a notification that there is a new version available and suggest to refresh the browser window to get it.

I think that's what Google Inbox, for example, does. They have this periodic checkJsVersion request and, if there is a newer version of the web app available, they show this information box on the bottom left with a "New version is available, hit Refresh to get it" button.

There is also a different approach when the information about a new version of the app is pushed from the server to the client.

Context

StackExchange DevOps Q#2552, answer score: 4

Revisions (0)

No revisions yet.