+ This app has just been updated!
+
+ Restart it to enjoy the new features.
+
+
+
+ );
+};
diff --git a/src/utils/helpers/sw.ts b/src/utils/helpers/sw.ts
new file mode 100644
index 00000000..a318047b
--- /dev/null
+++ b/src/utils/helpers/sw.ts
@@ -0,0 +1,16 @@
+export const forceUpdate = async () => {
+ const registrations = await navigator.serviceWorker?.getRegistrations() ?? [];
+
+ for (const registration of registrations) {
+ const { waiting } = registration;
+
+ waiting?.addEventListener('statechange', (event) => {
+ if ((event.target as any)?.state === 'activated') {
+ window.location.reload();
+ }
+ });
+
+ // The logic that makes skipWaiting to be called when this message is posted is in service-worker.ts
+ waiting?.postMessage({ type: 'SKIP_WAITING' });
+ }
+};