Release 202506151318

This commit is contained in:
pluja
2025-06-15 13:18:22 +00:00
parent effb6689d7
commit f3c9b92ddb
20 changed files with 159 additions and 77 deletions

View File

@@ -4,6 +4,7 @@
<script>
import { registerSW } from 'virtual:pwa-register'
import { unsubscribeFromPushNotifications } from '../lib/client/clientPushNotifications'
const NO_AUTO_RELOAD_ROUTES = ['/account/welcome', '/500', '/404'] as const satisfies `/${string}`[]
@@ -33,7 +34,7 @@
function shouldSkipAutoReload() {
const currentPath = window.location.pathname
const isErrorPage = document.querySelector('[data-is-error-page]') !== null
const isErrorPage = document.body.hasAttribute('data-is-error-page')
return isErrorPage || NO_AUTO_RELOAD_ROUTES.some((route) => currentPath === route)
}
@@ -48,4 +49,11 @@
window.addEventListener('beforeinstallprompt', (event) => {
event.preventDefault()
})
document.addEventListener('astro:page-load', async () => {
if (!document.body.hasAttribute('data-is-logged-in')) {
await unsubscribeFromPushNotifications()
window.__SW_REGISTRATION__?.unregister()
}
})
</script>