Add PWA update notification prompt

Implements service worker update detection with user prompt to refresh
This commit is contained in:
Chris Scott committed 2026-03-22 20:21:48 -04:00
1 parent e343a50807
commit 7f9598adeb
4 files changed
+89 -3

No files matched your search

@@ -0,0 +1,21 @@
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
}