Files
HealthLog/src/lib/query-keys/custom-metrics.ts
T
Marc-André Bombeck 62eb431d66 release: v1.32.0 — hardening and scalability (#580)
* release: prepare v1.32.0

* test: stabilize water capture re-entry
2026-07-22 04:14:15 +02:00

24 lines
1.1 KiB
TypeScript

/**
* v1.25.5 — TanStack Query keys for the user-defined custom-metric store.
*
* `customMetricEntries` bakes the metric id + sort direction into the key so an
* infinite-query accumulation never collides with another metric's feed (the
* project's queryKey-factory invariant). Mutations invalidate `customMetrics()`
* (the catalog list) and the per-metric detail / entry keys.
*/
export const customMetrics = {
/** The caller's custom-metric catalog list (with latest value). */
customMetrics: () => ["custom-metrics"] as const,
/** A single custom-metric detail. */
customMetricDetail: (id: string) => ["custom-metrics", "detail", id] as const,
/** Prefix for invalidating every sorted feed of one custom metric. */
customMetricEntriesPrefix: (customMetricId: string) =>
["custom-metric-entries", customMetricId] as const,
/** Paginated (offset) value feed for one custom metric. */
customMetricEntries: (params: { customMetricId: string; sortDir: string }) =>
["custom-metric-entries", params.customMetricId, params.sortDir] as const,
};