Skip to content Skip to sidebar Skip to footer

Spa Content Refresh With Constant Updating

I know that recommended approach to updating SPA versions is to use service workers and alert user that he should refresh page. But what options do we have when there's lots of pag

Solution 1:

You can achieve this task - "Show the alert to refresh the page when there is a new UI version available for the page being viewed by the user".

For that, you need to store version and updated UI modules for that version at the backend. e.g. lets say Report-1, Report-5 were changed in a new version 1.2.3.

Now, UI can send current UI version with each AJAX HTTP call (maybe in custom headers) and if the backend finds that UI is stale, it can respond with the new version and the list of changed UI modules: e.g. new version: 1.2.3 and changed UI modules: Report-1, Report-5.

Now UI can decide whether to show an alert or not by checking if the user is currently looking at one of the changed modules (which are Report-1 & Report-5 in this example).

So, for this example:

if the user is looking at Report-1, show the alert.

if the user is looking at Report-6, don't show the alert.

Post a Comment for "Spa Content Refresh With Constant Updating"