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

main
Claire 2 years ago committed by GitHub
parent 397845453e
commit 894ce3726a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save