Repository navigation
docs(guide): remove the lazy-loading promise nothing keeps from the schema-rendering guide (objectui#9989) - #10086
Conversation
…chema-rendering guide The Performance Optimization section taught a `tabs` node whose every key but `type` was undeclared, under the sentence "Large schemas are automatically optimized". Both halves were wrong, and the second decided the repair. Measured against the BUILT `TabsSchema`, the published node is refused with `invalid_type` at path `["items"]` — "expected array, received undefined" — while a well-formed `tabs` node parses green through the same instrument. The fence was also tagged `json` while containing a `/* … */` JavaScript comment, so a reader hit a parse error before reaching the schema at all. Whether anything lazy-loads tab bodies had never been measured. It does not: `lazyLoad` is declared on zero of the schemas the `zod` entry point exports (the same probe finds `defaultValue` on 17, so the zero is a reading). Its one real home is `PerformanceConfig`, the argument type of `usePerformance`, where it is resolved into the returned config and never branched on — its sibling `debounceMs` is the contrast, lifted into a local and handed to `setTimeout` — and no caller in the repository reads it back. The `tabs` renderer maps `items` twice unconditionally, for the triggers and for the panels, and uses neither `lazy` nor `Suspense`. So the promise is removed rather than respelled: correcting the keys while leaving the sentence would have been the same defect with better spelling. A correct `tabs` node stays at the address the wrong one occupied, labelled as reference rather than as an optimization, together with the two failure modes an author actually meets — a missing `value` / `label` / `content` is refused, a surviving `title` / `body` is silently dropped into an empty panel, and `body` / `children` on the node are refused by name. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HrVaotisyhgmot9o2MLRq
|
changeset-claim-re-read
|
Fixes #9989
Clause-②: no — a documentation page. It moves no exported symbol and no key on a published payload.
One file:
content/docs/guide/schema-rendering.md. Nothing outsidecontent/docs/**is edited.The card's one un-taken claim, re-taken here
The card relayed, without re-running it, that the published example is refused with
invalid_typeat path["items"]. Re-measured first-hand against the BUILTTabsSchema(packages/typesbuilt in this worktree, imported through the package's own./zodexport condition, i.e.dist/zod/index.zod.js— the surface a reader imports), reading the fence out of the file in the same command that measured it:⇒ The card's claim stands, verbatim. Two corrections to the reasoning around it, both first-hand:
TabsSchemaextendsBaseSchema, andBaseSchemaCoreends.passthrough(), which.extend()carries through. Measured: a correct node pluslazyLoadplustabsparses green and the surviving keys are["type","defaultValue","items","lazyLoad","tabs"]— both undeclared keys survive. The strip is real one level down:TabItemSchemais a plain object, and{value,label,content,title,body}comes back as["value","label","content"]. The empty-tab-bar outcome the card predicts is right; it arrives becauseitemsis absent, not because anything was stripped off the node.titletolabel,bodytocontent— still fails, becauseTabItemSchemarequiresvaluetoo:invalid_type@["items",0,"value"]and["items",1,"value"], plusinvalid_union@[…,"content"]for acontentthat is not a node. Addingvalueturns it green. The doc now teaches all three required item keys.Which route I took on the
lazyLoadpromise, and the measurement that decided itRoute taken: nothing lazy-loads tab bodies ⇒ the promise is removed, not respelled. The sentence "Large schemas are automatically optimized:" and its example are gone. Four readings, each with a same-subject control in the same command:
zodbarrel declaringlazyLoaddefaultValueon 17 of them.lazyLoadanywhere in the repositoryusePerformance.tsitself (the defaulting expression and the memo dependency)debounceMsis also lifted into a local and handed tosetTimeout—lazyLoadhas no such lineapps/console/src/components/PerformanceDashboard.tsxusePerformance()with no argument; readslazyLoad0 times andperf.config.0 timesmetrics15 times, so the file does use the hook's resulttabsrendererlazyLoad0 lines,React.lazy0,Suspense0,usePerformance0;schema.itemsmapped on 2 lines, unconditionally — triggers and panelsdefaultValueon 3 lines — the card's own control, a key this renderer really reads⇒
lazyLoadis inert even on the surface it genuinely belongs to:usePerformanceresolves it into the config object it returns and never branches on it, and no caller reads it back. And there is no lazy gate on the tabs path to point it at even if it were live. So correcting the keys while leaving the sentence would have been, in the card's words, the same defect with better spelling.Whether a corrected
tabsexample belongs in its place — I kept one, deliberately. The harm this card names has two halves: a false promise, and four wrong key spellings sitting at a well-trafficked address. Deleting the block repairs the first and abandons the second. The replacement keeps a correcttabsnode where the wrong one stood, labelledFor referencerather than as an optimization, and states the two failure modes an author actually meets — measured, not asserted:value,labelorcontentis refused (invalid_typeat that path — measured for all three);title/bodyis accepted with those keys dropped, so the panel renders empty with nothing naming the cause;bodyandchildrenare refused by name, by the ADR-0049 tombstones already inTabsSchema.The section now points deferral work at
Code Splitting, the mechanism further down the same page that does exist.The invalid-JSON half, and why no gate caught it
The old fence was tagged
jsonand carried a block comment, so a copy failed to parse before reaching the schema. After this change every one of the 13jsonfences on this page parses, checked byJSON.parsein the same command that hashed the file, with a deliberately broken literal as the instrument control. The replacement node alsosafeParses green against the builtTabsSchema, with the pre-fix node re-parsed by the same instrument as the negative control.Why no gate caught it — measured, ⛔ not fixed here (out of scope by the dispatch order): no gate in this repository asserts that a
json-tagged fence is valid JSON.check:doc-snippetscompilests/tsx/typescriptonly. Its own header: a json fence is never compiled against anything.check:doc-fencesasks whether a TypeScript body sits under a non-TypeScript fence. A JSON body under ajsonfence is exactly right by its classifier.check:doc-typesjudges thetypeliteral and, in its own words, deliberately not the snippet's other keys.check:doc-expression-carriageis the only gate that reads json fence bodies — and it is report-only, and its tolerance list removes line and block comments and re-escapes raw newlines before parsing. So the two shapes that make a fence uncopyable are normalized away by design. It printed225 json/jsonc fence(s), 225 parsed, 0 UNPARSEDon this tree.Population reading, taken here for the record: 22 of 199
jsonfences undercontent/docsare rejected byJSON.parse(control: the same parser rejects a trailing-comma literal, so the count is a reading). Several are deliberate — elision markers and// Bad:counter-examples — which is precisely why deciding the class is a triage call and not a drive-by widening of this PR. Reported for filing;#9941is not addressed here either.Verification
Gates re-run as the last action before the push, on the committed tree,
git status --porcelainandgit diff HEADboth empty at847e4eea8:check:doc-typestypeliteralscheck:doc-fencescheck:doc-example-idscheck:doc-snippetsPRECONDITION NOT MET: the closure was built first (turbo run build $(node scripts/check-doc-snippet-types.mjs --build-filter) --concurrency=2, 35/35), then 672 of 672 blocks judged, 0 failedcheck:doc-examplescheck:doc-example-readerscheck:prompt-keysdocs:check-linkscheck:control-bytescheck:spec-symbolscontent/docs/**check:new-line-citationscheck:docs-route-closurecheck:doc-expression-carriageTests that read this page, run from the repo root:
pnpm exec vitest run packages/components/src/__tests__/guide-schema-rendering-data-context-8021.test.tsx scripts/__tests__/check-doc-component-types.test.ts— 2 files, 132 tests passed.Changeset: none owed, decided by running the gate rather than from memory.
node scripts/check-changeset-presence.mjs— "1 file(s) changed, 0 of them published source of a package the release covers, 0 of them a manifest whose published contract moved … no changeset is owed."Ablation, proving the link gate really judges the new in-page anchor (the
Code Splittingreference is a new link, so its green needed to be a reading). Mutation and restore both proved by object hash against the HEAD blob, ⛔ never by an exit code, with the mutation script refusing on an anchor miss and restoring from atrap:Repository-wide scans (
pnpm lint, the fullpnpm test) are CI's run, not owed here; this diff touches no JavaScript or TypeScript source.Acceptance notes
Seen while measuring, ⛔ not filed and ⛔ not repaired here:
tabsrenderer readsitem.contentwith a tolerant fallback to a castitem.body. It is unreachable through the published face, which stripsbodyoff an item before the renderer sees it, so it only fires on a document that was never parsed. Successor who touches it: the next change toTabsSchema's item shape. Contract-first says a fix belongs on the producer side, ⛔ not in the consumer's fallback, and the producer here is already correct.Memoizationsubsection on this page asserts "the renderer automatically memoizes components". No measurement of that was taken in this act, in either direction; it is named so the next reader knows it is unmeasured rather than checked. Successor who touches it: whoever takes thejson-fence class below, since it is the same page.Generated by Claude Code