Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Avoid "update found" on initial load.

Jake Archibald53b46f879fbf
diff --git a/src/lib/offliner.ts b/src/lib/offliner.ts
index 928161c0..5c6e30c6 100644
--- a/src/lib/offliner.ts
+++ b/src/lib/offliner.ts
@@ -63,6 +63,10 @@ export async function offliner(showSnack: SnackBarElement['showSnackbar']) {
location.reload();
});
+ // If we don't have a controller, we don't need to check for updates – we've just loaded from the
+ // network.
+ if (!hasController) return;
+
const reg = await navigator.serviceWorker.getRegistration();
// Service worker not registered yet.
if (!reg) return;