Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/libs/actions/AppUpdate/updateApp/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import clearWorkboxRecoveryCaches from '@libs/clearWorkboxRecoveryCaches';

/**
* On web or mWeb we can simply refresh the page and the user should have the new version of the app downloaded.
* On web or mWeb, clear stale service worker and Cache Storage entries before reloading
* so the user gets the latest bundle instead of a cached version that triggers Update Required.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export default function updateApp(isProduction: boolean) {
window.location.reload();
clearWorkboxRecoveryCaches().then(() => window.location.reload());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the offline cache when updating offline

When the Update Required screen is open and the user has gone offline, this path now deletes Cache Storage and unregisters the service worker before reloading. The rest of the web recovery paths guard cache clearing with navigator.onLine because clearing the cached shell while offline leaves the PWA unable to reload until connectivity returns; this button can hit the same case after the server has already set RAM_ONLY_UPDATE_REQUIRED and connectivity drops. Please keep the plain reload fallback when offline and only clear Workbox caches while online.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes a big delay before the web reload, as explained here, which causes this issue

}
Loading