'use client'

import { useEffect } from 'react'

/** Désenregistre d’anciens service workers (remplace /scripts/sw-cleanup.js). */
export function SwCleanup() {
  useEffect(() => {
    if (!('serviceWorker' in navigator)) return
    void navigator.serviceWorker.getRegistrations().then((rs) => {
      rs.forEach((r) => {
        void r.unregister()
      })
    })
  }, [])
  return null
}
