perf: reduce background return latency via session caching and async map rendering

This commit is contained in:
2026-03-04 10:43:58 -05:00
parent 90bb93be17
commit b89de437b2
3 changed files with 8 additions and 5 deletions

View File

@ -48,9 +48,9 @@ export const useRouteStore = defineStore('route', () => {
// Si estamos en background, podemos sobreescribir la carga sin mostrar spinner
if (isLoadingRoutes.value && !isBackground) return;
// Si no forzamos, no hay filtros raros, ya tenemos rutas y aún no expira el caché, omitir llamada
// Excepción: isBackground de refocus obliga a actualizar para asegurar frescura después de mucho rato apagado.
if (!force && !isBackground && !filters && allRoutes.value.length > 0 && (now - lastFetched.value < CACHE_TIME)) {
// Si no forzamos, no hay filtros raros, ya tenemos rutas y aún no expira el caché, omitir llamada.
// Se respeta en background también porque descargar docenas de rutas traba el Javascript en móviles.
if (!force && !filters && allRoutes.value.length > 0 && (now - lastFetched.value < CACHE_TIME)) {
return
}