diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index c60f79e..ff22e0c 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -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 diff --git a/frontend/src/views/SplashScreen.vue b/frontend/src/views/SplashScreen.vue index bd5bb64..0a2a176 100644 --- a/frontend/src/views/SplashScreen.vue +++ b/frontend/src/views/SplashScreen.vue @@ -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 { diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 73b0b24..54b70a1 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -11,6 +11,7 @@ export default defineConfig(() => { vue(), tailwindcss(), VitePWA({ + selfDestroying: true, registerType: 'autoUpdate', includeAssets: ['icon-192.png', 'icon-512.png', 'icon-1024.png', 'favicon.ico'], manifest: {