diff --git a/web/app/components/provider/serwist.tsx b/web/app/components/provider/serwist.tsx index 5cd7d63580..0cb4e01c7e 100644 --- a/web/app/components/provider/serwist.tsx +++ b/web/app/components/provider/serwist.tsx @@ -7,15 +7,17 @@ import { IS_DEV } from '@/config' export function PWAProvider({ children }: { children: React.ReactNode }) { useEffect(() => { if (IS_DEV && 'serviceWorker' in navigator) { - navigator.serviceWorker.getRegistrations().then((registrations) => { - registrations.forEach((registration) => { - registration.unregister() + navigator.serviceWorker.getRegistrations() + .then((registrations) => { + return Promise.all( + registrations.map(registration => registration.unregister()), + ) + }) + .catch((error) => { + // Silently fail if service worker unregistration fails + // This is a development-only optimization and shouldn't block the app + console.warn('Failed to unregister service workers:', error) }) - }).catch((error) => { - // Silently fail if service worker unregistration fails - // This is a development-only optimization and shouldn't block the app - console.warn('Failed to unregister service workers:', error) - }) } }, [])