mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-18 16:12:11 +00:00
refactor(meds): lift IntakeImportDialog out of the list page and bundle the inline-compliance prefix
The list page was carrying two large dialogs (`IntakeImportDialog` and `ApiEndpointDialog`) whose state slots had no list-card trigger wired to them. The slots were only ever set from inside the dialogs themselves, so they read as dead code on the list page even though the dialog bodies themselves were healthy. `IntakeImportDialog` lifts to `src/components/medications/intake-import-dialog.tsx` as the canonical mount the detail-page intake-history header will import. `ApiEndpointDialog` no longer mounts on the list page; its final v1.5.5 home is the detail-page Settings sub-row (lands in a later commit). The list page drops the two state slots, the inline dialog bodies, and the now-unused imports. `medicationDependentKeys` also gains the `compliance-chart-inline` prefix. The per-medication inline compliance chart used to mount under `queryKeys.medicationComplianceChart(id)` (which expands to `["compliance-chart-inline", id]`) but the bundle did not match the prefix, so an intake mutation left the chart up to 60 s stale. The prefix now lands in the bundle so every detail-page mutation evicts the tile in one tick. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c97c4c3be3
commit
ef21967d12
4 files changed
+287
-602
No files matched your search
@@ -223,6 +223,16 @@ describe("dependent-key bundles", () => {
|
||||
const keyStrings = medicationDependentKeys.map((k) => JSON.stringify(k));
|
||||
expect(keyStrings).toContain(JSON.stringify(["dashboard-medication-compliance"]));
|
||||
});
|
||||
|
||||
// v1.5.5 D-3 §10 invariant 20 — the per-medication inline compliance
|
||||
// chart cache key (`["compliance-chart-inline", medicationId]`) needs
|
||||
// its prefix in the bundle so every detail-page mutation evicts the
|
||||
// tile in one tick. Hierarchical prefix-match catches every per-id
|
||||
// slot beneath it.
|
||||
it("medicationDependentKeys bundles the compliance-chart-inline prefix (v1.5.5)", () => {
|
||||
const keyStrings = medicationDependentKeys.map((k) => JSON.stringify(k));
|
||||
expect(keyStrings).toContain(JSON.stringify(["compliance-chart-inline"]));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -353,6 +353,19 @@ export const moodDependentKeys = [
|
||||
* `["dashboard-medication-compliance"]` lands in the bundle so an
|
||||
* intake POST refreshes the chart immediately rather than waiting for
|
||||
* `staleTime` (audit L4).
|
||||
*
|
||||
* v1.5.5 D-3 §10 invariant 20 (was C-E2-1 / H-cluster-G) — the
|
||||
* per-medication inline compliance chart used to mount under
|
||||
* `queryKeys.medicationComplianceChart(medicationId)` which expands to
|
||||
* `["compliance-chart-inline", id]`. The prefix `["compliance-chart-inline"]`
|
||||
* lands in the bundle so every detail-page mutation (today's-dose,
|
||||
* Pausieren, end, purge, edit) evicts the inline compliance tile in
|
||||
* one tick. The TanStack hierarchical-prefix semantics catch every
|
||||
* per-medication slot under that prefix.
|
||||
*
|
||||
* `queryKeys.medicationDetail(id)` rides under the
|
||||
* `["medications"]` prefix already so a single medication invalidation
|
||||
* also evicts its detail-page read.
|
||||
*/
|
||||
export const medicationDependentKeys = [
|
||||
queryKeys.medications(),
|
||||
@@ -361,6 +374,7 @@ export const medicationDependentKeys = [
|
||||
queryKeys.insightsTargets(),
|
||||
queryKeys.gamificationAchievements(),
|
||||
["dashboard-medication-compliance"] as const,
|
||||
["compliance-chart-inline"] as const,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user