---
id: w8/m6/t003
title: useUsage hook accepts and refetches on period
worker: worker8
status: todo
estimate: 30m
depends_on: [w8/m6/t002]
---

## Objective

Update the dashboard's `useUsage` hook and Apollo query to accept a `period` parameter and refetch when it changes.

## Context

- `dashboard/src/features/usage/hooks/use-usage.ts` currently queries the current month only.
- Codegen (`dashboard/codegen.ts`) needs the regenerated query/types after t002's GraphQL schema change.

## Steps

1. Regenerate GraphQL types (`yarn codegen`, needs `CODEGEN_SESSION_TOKEN` per `dashboard/CLAUDE.md`) after t002 ships.
2. Add a `period` parameter to `useUsage`, defaulting to the current month.
3. Refetch (or re-run the query) when `period` changes.

## Files

- `dashboard/src/features/usage/hooks/use-usage.ts`
- `dashboard/src/graphql/definitions.ts` (generated)

## Acceptance criteria

- [ ] Calling `useUsage({ period: "2026-06" })` returns June 2026's data.
- [ ] Changing the period value triggers a refetch, not a stale render.

## Out of scope

- The month-selector UI itself (t004).
