3

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?

Pierre.Vriens
  • 7,225
  • 14
  • 39
  • 84
RandomUs1r
  • 133
  • 4

1 Answers1

4

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.

alecxe
  • 849
  • 1
  • 16
  • 36