Files
opencode-manager/frontend/src/components/PwaUpdatePrompt.tsx
T
Chris Scott 7f9598adeb Add PWA update notification prompt
Implements service worker update detection with user prompt to refresh
2026-03-22 20:21:48 -04:00

22 lines
574 B
TypeScript

import { useEffect } from 'react'
import { showToast } from '@/lib/toast'
import { onServiceWorkerUpdate, offServiceWorkerUpdate } from '@/lib/serviceWorker'
export function PwaUpdatePrompt() {
useEffect(() => {
onServiceWorkerUpdate(() => {
showToast.info('New build deployed', {
description: 'Refresh to load the latest changes.',
action: {
label: 'Refresh',
onClick: () => window.location.reload(),
},
duration: Infinity,
})
})
return () => offServiceWorkerUpdate()
}, [])
return null
}