Proyecciones: clicking a month row opens that month in Budget

The clicked year/month now travel in the navigation state; Budget
seeds useBudget with them instead of always defaulting to today.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Carlos Escalante
2026-07-03 20:40:09 -06:00
parent f832138b41
commit 72a5840752
3 changed files with 17 additions and 8 deletions

View File

@@ -16,11 +16,11 @@ import {
/** All budget data hangs off the ['budget', ...] key family; every mutation
* invalidates the family so projection, month detail and items stay in sync. */
export function useBudget(initialYear: number) {
export function useBudget(initialYear: number, initialMonth?: number) {
const queryClient = useQueryClient();
const [year, setYear] = useState(initialYear);
const [selectedMonth, setSelectedMonth] = useState<number>(
new Date().getMonth() + 1,
initialMonth ?? new Date().getMonth() + 1,
);
const projectionQ = useQuery({