fix(website): dont crash when serviceWorker is not available (#9331)

This commit is contained in:
Almeida 2023-04-07 08:22:09 +01:00 committed by GitHub
parent 6912faa9b3
commit 24f280290b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,7 @@ import { useEffect } from 'react';
export function useUnregisterServiceWorker() {
useEffect(() => {
// eslint-disable-next-line promise/prefer-await-to-then
void navigator.serviceWorker.getRegistrations().then((registrations) => {
void navigator.serviceWorker?.getRegistrations().then((registrations) => {
for (const registration of registrations) {
void registration.unregister();
}