fix(pwa): force service worker unregistration to distribute latest fixes

This commit is contained in:
2026-02-26 09:22:38 -05:00
parent d329336020
commit 12f5871f6f
2 changed files with 23 additions and 6 deletions

View File

@ -5,6 +5,15 @@ import i18n from './i18n'
import './style.css'
import App from './App.vue'
// Force unregister service workers to clear cache for now
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then((registrations) => {
for (const registration of registrations) {
registration.unregister();
}
});
}
const app = createApp(App)
const pinia = createPinia()

View File

@ -18,7 +18,7 @@
<!-- Version info -->
<div class="version-info">
<p class="app-subtitle">Transporte Público Boquete</p>
<p class="app-version">Versión 2.0.0</p>
<p class="app-version">Versión 2.0.1</p>
</div>
</div>
</template>
@ -48,7 +48,7 @@ onMounted(async () => {
const initTimeout = setTimeout(() => {
console.warn('Initialization taking too long, forcing navigation...')
statusMessage.value = 'Iniciando de todas formas...'
navigate()
navigate(null, true)
}, 3000)
try {
@ -63,13 +63,21 @@ onMounted(async () => {
} catch (error) {
console.error('Initialization failed', error)
clearTimeout(initTimeout)
navigate()
navigate(null, true)
}
})
async function navigate(passedSession?: any) {
// Use passed session or fetch if missing
const session = passedSession || (await supabase.auth.getSession()).data.session
async function navigate(sessionData?: any, force = false) {
let session = sessionData;
if (!session && !force) {
try {
const resp = await supabase.auth.getSession()
session = resp.data.session
} catch (e) {
console.warn('Silent auth check failed', e)
}
}
if (!session) {
router.replace('/map')