lime-app icon indicating copy to clipboard operation
lime-app copied to clipboard

After firmware upgrade, the browser serves the previous cached version.

Open germanferrero opened this issue 2 years ago • 0 comments

The problem When a user does a firmware upgrade, and in consequence expect a new version of the LimeApp to be served by the node, she visits minodo.info and the browser shows up the LimeApp from the previous firmware version.

Mitigation It can be usually solved by refreshing a couple of times.

Possible Reason Even if webpack generates js and css assets with a hash on it's name, thus forcing browsers to retrieve these fresh assets when linked in the document, these links are referenced in the index.html, which can be the one being cached by browsers.

Possible solutions

  • To setup Cache-Control HTTP header for the GET requests of index.html, with a policy such as "no-store". Forcing browsers to always retrieve a fresh document. The header should be added by the uhttpd web server in the backend but there's no simple way of doing it AFAIK.
  • To display a button to "Update to last version" when the current asset is known to be the one from the previous firmware version. Maybe:
    • Storing the asset's URL from import.meta in local storage associated with the firmware version from getBoardData() / ubus call system board.
    • Early fetching firmware version on app start-up. Compare and if it doesn't match...
    • Display the button that deletes cache (see mdn here) and reloads the page.

germanferrero avatar Dec 17 '21 13:12 germanferrero