mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
perf(insights): keep Zod off the first load of the metric pages
The value domain read the plausibility band out of the measurement validation module, so every metric sub-page that asks whether a metric can be negative or is integer-valued loaded the measurement schemas and Zod with them. The band and its check live in a Zod-free module now, re-exported by the validation module for the server writers, and the values list checks its segment against the exhaustive type label map instead of the Zod enum. About fifty metric routes drop roughly 88 KB gzip from their first load. The client-route guard walks a metric page and the values list too.
This commit is contained in:
1 parent
41c906e862
commit
ebdb63f0d8
6 files changed
+284
-258
No files matched your search
@@ -1,5 +1,6 @@
|
||||
/**
|
||||
* The documents vault and the Coach load no schema library in the browser.
|
||||
* The documents vault, the Coach and the metric pages load no schema library
|
||||
* in the browser.
|
||||
*
|
||||
* Both routes reached zod through a constant: the list of document kinds, the
|
||||
* bulk limit, the attachment cap, the Coach data clusters, a conversation
|
||||
@@ -121,6 +122,11 @@ describe("client routes without the schema library", () => {
|
||||
"src/app/documents/page.tsx",
|
||||
"src/app/coach/page.tsx",
|
||||
"src/app/coach/conversations/page.tsx",
|
||||
// The metric sub-pages read the plausibility band through the value
|
||||
// domain (`src/lib/measurements/value-ranges.ts`), and the values list
|
||||
// checks its segment against the type label map.
|
||||
"src/app/insights/pulse/page.tsx",
|
||||
"src/app/insights/values/[type]/page.tsx",
|
||||
]) {
|
||||
it(`${route} ships no zod in its static client graph`, () => {
|
||||
const hits = clientZodImports(route);
|
||||
|
||||
Reference in new issue
Block a user