Files
HealthLog/src/lib/query-keys/day.ts
T
Marc-André Bombeck c41ec02e92 feat: prepare the next visit from the server's notable window
The block under a planned visit read the day index and up to twelve days
to find what changed, so a dose change on a quiet day could fall out of
the picked days. It now reads GET /api/day/notable for the stretch from
the last visit to today: every change the server names, every notable
reading.

Add a guard that walks every chart, chart mount and calendar heatmap and
fails when one drawn in days lacks the day doors and is not on the
reasoned NOT_HERE list. Give the dose-strength curve, the efficacy chart,
the mood dimensions, the intraday pulse header and the environment note
the same doors.
2026-10-08 15:30:12 +02:00

22 lines
981 B
TypeScript

/**
* Query keys — the day view (v1.42, #613): one local day, and the index of
* days that hold anything over a window.
* Part of the centralized factory; aggregated in `./index.ts`.
*
* Everything sits under the `["day"]` root so a write to any record table can
* evict every open day at once: the record data bundles in `./index.ts` carry
* the root, and a day is cheap enough to re-read that finer keys would only
* add ways to miss one.
*/
export const dayKeys = {
/** Root prefix; the data-dependent bundles invalidate through it. */
dayRoot: () => ["day"] as const,
/** `GET /api/day/{date}`. */
day: (date: string) => ["day", "detail", date] as const,
/** `GET /api/day/index`: the window bounds are the key. */
dayIndex: (from: string, to: string) => ["day", "index", from, to] as const,
/** `GET /api/day/notable`: what changed in a window, for a visit. */
dayNotable: (from: string, to: string) =>
["day", "notable", from, to] as const,
};