Migrate Analytics, Salarios, Pensions, ServiciosMunicipales, Proyecciones to queries

Every page now goes through TanStack Query with cancellation,
placeholder data on filter changes, and a visible ErrorState with retry
instead of console.error/silent-empty rendering (FE-02, UX-02).
Analytics keeps the trend query on its own key so cycle changes don't
refetch it. Pensions/Servicios upload-triggered refreshes are bounded
by the api-level 30s timeout (FE-05); pension upload results cap at 10
rows with an overflow note (FE-19). Note: the Pensions ROI fallback
already guarded short chart data — FE-04 was already handled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Carlos Escalante
2026-06-10 17:23:52 -06:00
parent 65dffdac06
commit 7a1733bf7e
5 changed files with 139 additions and 88 deletions

View File

@@ -6,6 +6,7 @@ import { formatAmount } from '@/lib/format';
import { cn } from '@/lib/utils';
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
import ErrorState from '@/components/ErrorState';
import YearlyOverview from '@/components/budget/YearlyOverview';
const MIN_YEAR = 2026;
@@ -19,6 +20,8 @@ export default function Proyecciones() {
setSelectedMonth,
projection,
loading,
error,
refresh,
saveBalanceOverride,
clearBalanceOverride,
} = useBudget(currentYear);
@@ -89,7 +92,10 @@ export default function Proyecciones() {
) : projection ? (
<Card>
<CardContent className="p-0">
<YearlyOverview
{error ? (
<ErrorState onRetry={refresh} />
) : (
<YearlyOverview
months={projection.months}
selectedMonth={0}
year={year}
@@ -104,6 +110,7 @@ export default function Proyecciones() {
await clearBalanceOverride(year, month);
}}
/>
)}
</CardContent>
</Card>
) : null}