Browse Source

Fix unnecessary service worker registration and preloading when logged out (#20341)

closed-social-glitch-2
Claire 1 year ago
committed by GitHub
parent
commit
894ce3726a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions
  1. +8
    -8
      app/javascript/mastodon/main.js

+ 8
- 8
app/javascript/mastodon/main.js View File

@ -25,17 +25,17 @@ function main() {
import('mastodon/initial_state'),
]);
const wb = new Workbox('/sw.js');
if (me) {
const wb = new Workbox('/sw.js');
try {
await wb.register();
} catch (err) {
console.error(err);
try {
await wb.register();
} catch (err) {
console.error(err);
return;
}
return;
}
if (me) {
const registerPushNotifications = await import('mastodon/actions/push_notifications');
store.dispatch(registerPushNotifications.register());

Loading…
Cancel
Save