mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
22 lines
574 B
TypeScript
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
|
|
}
|