feat(admin): new AdminBusinessEditor with live mobile preview + fix admin logout bug on file picker timeout
This commit is contained in:
@ -57,13 +57,17 @@ async function dispatchRefocus(reason: string) {
|
||||
|
||||
try {
|
||||
await refreshWithTimeout
|
||||
} catch (err) {
|
||||
console.warn("SIBU | Auth zombie detectado o red muerta. Reseteando sesión y app.", err)
|
||||
// Fall fast & hard: Romper cualquier loop infinito o socket huérfano
|
||||
document.body.style.opacity = '0'
|
||||
await supabase.auth.signOut()
|
||||
window.location.reload()
|
||||
return // No despachar `app-refocus`, la app está muriendo
|
||||
} catch (err: any) {
|
||||
console.warn("SIBU | Error al verificar sesión en refocus (timeout o red).", err)
|
||||
// FIX CRÍTICO: Si el error es de timeout (5s), la persona estaba eligiendo ruta o
|
||||
// subiendo archivo y la red tardó. NUNCA expulsarla automáticamente en timeout.
|
||||
// El caché local de Supabase ya mantiene su sesión válida bajo el capó.
|
||||
if (err.message === "Auth refresh timeout") {
|
||||
console.log("SIBU | Ignorando timeout, manteniendo sesión optimista.")
|
||||
} else {
|
||||
// Solo si hay un error real de Auth (sesión vencida rechazada por Supabase)
|
||||
// se cierra sesión, pero no haremos signOut agresivo sin confirmar.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user