fix(pwa): completely destroy service worker cache and fix chunk load errors to stop freezing

This commit is contained in:
2026-02-26 11:05:43 -05:00
parent 82a2c1d903
commit 86726e3dfc
3 changed files with 11 additions and 8 deletions

View File

@ -181,4 +181,11 @@ router.beforeEach(async (to, _from, next) => {
next()
})
router.onError((error, to) => {
// Si falla la carga de un chunk (al actualizar la app), recarga la página para obtener la última versión
if (error.message.includes('Failed to fetch dynamically imported module') || error.message.includes('Importing a module script failed')) {
window.location.href = to.fullPath
}
})
export default router

View File

@ -45,15 +45,10 @@ onMounted(async () => {
loadingVisible.value = true
// Timeout logic
const initTimeout = setTimeout(async () => {
const initTimeout = setTimeout(() => {
console.warn('Initialization taking too long, forcing navigation...')
statusMessage.value = 'Iniciando de todas formas...'
try {
const resp = await supabase.auth.getSession()
navigate(resp.data.session)
} catch {
navigate()
}
statusMessage.value = 'Iniciando modo sin conexión...'
router.replace('/map')
}, 4000)
try {