diff --git a/frontend/src/pages/OtrosGeneral.jsx b/frontend/src/pages/OtrosGeneral.jsx index 5b034a5..2f24501 100644 --- a/frontend/src/pages/OtrosGeneral.jsx +++ b/frontend/src/pages/OtrosGeneral.jsx @@ -13,6 +13,7 @@ export default function OtrosGeneral() { const [filtros, setFiltros] = useState({ anos: [2026] }); const [data, setData] = useState(null); const [loading, setLoading] = useState(true); + const [recargando, setRecargando] = useState(false); const [error, setError] = useState(null); const [expAlways, setExpAlways] = useState({}); const [expAlwaysProg, setExpAlwaysProg] = useState({}); @@ -34,11 +35,12 @@ export default function OtrosGeneral() { useEffect(() => { let activo = true; - if (!data) setLoading(true); // spinner solo en la primera carga + if (!data) setLoading(true); else setRecargando(true); // spinner solo 1a carga setError(null); api.otrosGeneral(ano, mes, dia) - .then((res) => { if (activo) { setData(res); setLoading(false); } }) - .catch((e) => { if (activo) { setError(e.message); setLoading(false); } }); + .then((res) => { if (activo) setData(res); }) + .catch((e) => { if (activo) setError(e.message); }) + .finally(() => { if (activo) { setLoading(false); setRecargando(false); } }); return () => { activo = false; }; }, [ano, mes, dia, reload]); @@ -63,7 +65,8 @@ export default function OtrosGeneral() { {loading ? : error ? : !data ? : - <> +
{/* ── Inversión Publicitaria por Sede (Always On) ── */} {data.matriz_always && data.matriz_always.filas && (
@@ -328,7 +331,7 @@ export default function OtrosGeneral() {
)} - } + } ); }