mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
Add PWA update notification prompt
Implements service worker update detection with user prompt to refresh
This commit is contained in:
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
|
||||
}
|
||||
Reference in new issue
Block a user