fix(medications): keep the request schemas out of the wizard bundle

The note field imported its length limit from the validation module,
which pulled zod and the medication request schemas into the client and
put the medications list and detail pages over their bundle budget. The
limit lives in a zod-free module now, and the validation re-exports it.
This commit is contained in:
Marc-André Bombeck committed 2026-11-14 09:35:35 +01:00
1 parent 4537ff0d8e
commit d0b7749a99
3 files changed
+11 -8

No files matched your search

@@ -3,7 +3,7 @@
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { useTranslations } from "@/lib/i18n/context";
import { MEDICATION_NOTE_MAX_CHARS } from "@/lib/validations/medication/base";
import { MEDICATION_NOTE_MAX_CHARS } from "@/lib/medications/note-limits";
import type { StepProps } from "./step1-name";
+8
View File
@@ -0,0 +1,8 @@
/**
* #1371 — the longest note a medication carries. Room for a full set of
* directions ("on an empty stomach, 30 to 60 minutes before breakfast, not
* within four hours of calcium or iron") with space to spare. Its own module,
* free of zod, so the editor can cap its input without pulling the request
* schemas into the page bundle.
*/
export const MEDICATION_NOTE_MAX_CHARS = 500;
+2 -7
View File
@@ -4,6 +4,7 @@ import { INJECTION_SITE_KEYS } from "@/lib/medications/injection-sites";
import { validateEntryInstant } from "@/lib/validations/entry-instant";
import { hhmmToMinutes } from "@/lib/medications/scheduling/hhmm";
import { isoDateTime } from "@/lib/validations/datetime";
import { MEDICATION_NOTE_MAX_CHARS } from "@/lib/medications/note-limits";
/**
* v1.8.5 — the eight injection-site enum values, mirrored from the
@@ -63,13 +64,7 @@ export const rxNormCodeField = z
.describe(
"Optional RxNorm RxCUI (numeric, US identifier, e.g. `2601723`). Secondary coding emitted under `http://www.nlm.nih.gov/research/umls/rxnorm` alongside any ATC code, never instead of the free-text name. NULL clears it; absent leaves it untouched.",
);
/**
* #1371 — the longest note a medication carries. Room for a full set of
* directions ("on an empty stomach, 30 to 60 minutes before breakfast, not
* within four hours of calcium or iron") with space to spare; the editor caps
* its input at the same length.
*/
export const MEDICATION_NOTE_MAX_CHARS = 500;
export { MEDICATION_NOTE_MAX_CHARS };
/**
* #1371 — the person's own note on a medication. Trimmed; an empty string or
* NULL clears it, absent leaves it untouched. Sealed at rest by the writer.