fix: prevent install prompt showing in installed PWA
- Improve installation status detection logic - Add proper DOM cleanup when PWA is installed - Enhance monitoring for installation state changes - Fix shouldShowPrompt() logic to always check current status - Add forceInstallationCheck() method for manual status updates
This commit is contained in:
9
sw.js
9
sw.js
@@ -57,6 +57,15 @@ const CACHE_FIRST_PATTERNS = [
|
||||
/logo/
|
||||
];
|
||||
|
||||
self.addEventListener('message', (event) => {
|
||||
if (event.data && event.data.type === 'PWA_INSTALLED') {
|
||||
self.clients.matchAll().then(clients => {
|
||||
clients.forEach(client => {
|
||||
client.postMessage({ type: 'PWA_INSTALL_DETECTED' });
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
// Install event - cache static assets with better error handling
|
||||
self.addEventListener('install', (event) => {
|
||||
console.log('🔧 Service Worker installing...');
|
||||
|
||||
Reference in New Issue
Block a user