feat: proactively unregister service workers in dev mode

Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-23 03:26:09 +00:00
parent ed34e302f2
commit e6d925cad0

View File

@ -1,9 +1,20 @@
'use client'
import { SerwistProvider } from '@serwist/turbopack/react'
import { useEffect } from 'react'
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()
})
})
}
}, [])
if (IS_DEV) {
return <>{children}</>
}