fix(papeleria): mover useMemo antes del return condicional para evitar error #310

This commit is contained in:
Horux Dev
2026-05-29 16:42:37 +00:00
parent 9b535354fb
commit 0815269f1b

View File

@@ -229,6 +229,13 @@ export function PapeleriaTab() {
onSuccess: invalidate, onSuccess: invalidate,
}); });
const items = query.data ?? [];
const años = useMemo(() => {
const set = new Set<number>([currentYear]);
items.forEach(i => set.add(i.anio));
return [...set].sort((a, b) => b - a);
}, [items, currentYear]);
if (!selectedContribuyenteId) { if (!selectedContribuyenteId) {
return ( return (
<Card> <Card>
@@ -239,13 +246,6 @@ export function PapeleriaTab() {
); );
} }
const items = query.data ?? [];
const años = useMemo(() => {
const set = new Set<number>([currentYear]);
items.forEach(i => set.add(i.anio));
return [...set].sort((a, b) => b - a);
}, [items, currentYear]);
return ( return (
<div className="space-y-4"> <div className="space-y-4">
{/* Filtros + upload */} {/* Filtros + upload */}