fix(ui): no desmontar la pantalla en cada recarga en segundo plano

Las 11 pantallas con listado/detalle bloqueaban TODO su render con
"if (loading || !data) return <Cargando/>". Como useAsync pone loading=true en
cada reload (no solo en la carga inicial), cualquier accion dentro de un
DetailPopup abierto que dispara un reload del padre (agregar subtarea, agregar
dependencia, guardar comentario, etc.) desmontaba momentaneamente TODA la
pantalla -y con ella el popup y su estado interno (pestaña activa)-, que volvia
a montarse desde cero con sus valores iniciales.

Sintoma reportado: al agregar una subtarea (Enter o boton "Nuevo"), el popup de
la actividad volvia a la pestaña Info en vez de quedarse en Subtareas.

Fix: la guarda ahora es solo "if (!data)" -bloquea unicamente la carga
inicial, cuando todavia no hay nada que mostrar-. Las recargas subsiguientes
actualizan el contenido en el sitio sin desmontar nada.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Milton Gonzalez
2026-09-03 11:30:20 -05:00
parent 1e6e7fecdd
commit b172a8f087
11 changed files with 22 additions and 22 deletions
@@ -22,7 +22,7 @@ function emptyForm(fields) {
export function CatalogEditor({ catalogKey, fields, title }) {
const { t, openDialog, pushToast } = useUi();
const runAction = useAction();
const { data: items, loading, reload } = useAsync(() => listCatalog(catalogKey), [catalogKey]);
const { data: items, reload } = useAsync(() => listCatalog(catalogKey), [catalogKey]);
const [editing, setEditing] = useState(false);
const [selected, setSelected] = useState(null);
const [form, setForm] = useState(emptyForm(fields));
@@ -75,7 +75,7 @@ export function CatalogEditor({ catalogKey, fields, title }) {
: undefined,
}));
if (loading || !items) return <div className="text-muted">{t('common_loading')}</div>;
if (!items) return <div className="text-muted">{t('common_loading')}</div>;
return (
<div>