This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
fix(components): EmptyDescription declares the div it renders, not a p - #8574
Merged
Merged
Conversation
`EmptyDescription` declared `React.ComponentProps<"p">` over a `div`, verbatim from upstream shadcn's empty.tsx (in this tree since b1fd1a8). The type is now `React.ComponentProps<"div">`; the element is unchanged by ruling — a `p` cannot hold block content, so a real paragraph is a rendered-output change at every call site and its own card. Measured before writing the pin: TypeScript 6.0.3 treats the two props types as identical (lib.dom's HTMLDivElement and HTMLParagraphElement share every member), so neither tsc program nor a vitest render can see "p" vs "div", and there is no div-only prop to accept. The guard added here therefore reads the SOURCE: for every function component under src/custom whose annotation names `React.ComponentProps<"TAG">` and whose root return is an intrinsic element, the literal must be the tag, tied to the DOM by rendering each Empty member and reading tagName. It refuses the `"div" & "p"` widening (two literals) and `any` (drops out of the judged population). The one other disagreement it finds, kbd.tsx's KbdGroup (declares "div", returns kbd), is ledgered as a ratchet for its own ruling. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
os-justin
marked this pull request as ready for review
September 8, 2026 13:07
os-justin
enabled auto-merge
September 8, 2026 13:07
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
os-justin
deleted the
claude/issue-8571-emptydescription-element-type
branch
September 8, 2026 13:37
os-sales
added a commit
that referenced
this pull request
Sep 8, 2026
Brings the branch up to date after #8569, #8574 and the rest landed. No conflict: nothing on main touched packages/types/src/__tests__/zod-mirror-parity.test.ts since this branch's base f5cfbbd, so the objectui#8458 pin and the objectui#8248 amendment compose with main rather than contending with it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CZY49skxUBYyJcdnTcYPrE
os-zhuang
pushed a commit
that referenced
this pull request
Sep 9, 2026
…ectui#8576) `KbdGroup` annotated its props `React.ComponentProps<"div">` and returned a `kbd` — upstream shadcn's shape too, and the last entry in the class-wide ledger PR #8574 opened for objectui#8571. The ruling is direction 1, type follows element: `kbd` is what ships, what upstream ships, and a `kbd` grouping `kbd`s is legal HTML, so the half that was lying is the half that moves. Making the element follow the declaration instead would change the DOM every existing consumer already receives. Measured before choosing an instrument, one narrow program per leg (TypeScript 6.0.3, @types/react 19.2.18): `Equal<ComponentProps<'div'>, ComponentProps<'kbd'>>` is FALSE, with `Equal<ComponentProps<'div'>, ComponentProps<'p'>>` TRUE in the same program as a positive control — objectui#8571's result reproduced, so the FALSE is a reading rather than a broken `Equal`. The prop names are identical (`keyof` equal; `HTMLAttributes` is one interface for every element); the element type parameter is what moves, so `ref` and `currentTarget` become `HTMLElement`. That makes `tsc` a discriminating instrument here, which it was not on objectui#8571. Census: `KbdGroup` has no call site in this repository, only its definition and the `export *` barrel. For published consumers the props type widens (`ComponentProps<'div'>` is assignable to `ComponentProps<'kbd'>`, not the reverse), and a `div`-typed ref object or ref callback is still accepted. The ratchet was exercised, not assumed: the ledger line `'kbd.tsx:KbdGroup': 'div -> kbd'` was deleted FIRST, with the declaration still `"div"`, and the sweep failed on `every judged member under src/custom names the intrinsic it returns, except the ledgered cards` before the repair was written. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01611D6ZaRaMmwTNQmSbk8MH
akarma-synetal
pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Sep 17, 2026
…ectui#8576) (objectstack-ai#8891) `KbdGroup` annotated its props `React.ComponentProps<"div">` and returned a `kbd` — upstream shadcn's shape too, and the last entry in the class-wide ledger PR objectstack-ai#8574 opened for objectui#8571. The ruling is direction 1, type follows element: `kbd` is what ships, what upstream ships, and a `kbd` grouping `kbd`s is legal HTML, so the half that was lying is the half that moves. Making the element follow the declaration instead would change the DOM every existing consumer already receives. Measured before choosing an instrument, one narrow program per leg (TypeScript 6.0.3, @types/react 19.2.18): `Equal<ComponentProps<'div'>, ComponentProps<'kbd'>>` is FALSE, with `Equal<ComponentProps<'div'>, ComponentProps<'p'>>` TRUE in the same program as a positive control — objectui#8571's result reproduced, so the FALSE is a reading rather than a broken `Equal`. The prop names are identical (`keyof` equal; `HTMLAttributes` is one interface for every element); the element type parameter is what moves, so `ref` and `currentTarget` become `HTMLElement`. That makes `tsc` a discriminating instrument here, which it was not on objectui#8571. Census: `KbdGroup` has no call site in this repository, only its definition and the `export *` barrel. For published consumers the props type widens (`ComponentProps<'div'>` is assignable to `ComponentProps<'kbd'>`, not the reverse), and a `div`-typed ref object or ref callback is still accepted. The ratchet was exercised, not assumed: the ledger line `'kbd.tsx:KbdGroup': 'div -> kbd'` was deleted FIRST, with the declaration still `"div"`, and the sweep failed on `every judged member under src/custom names the intrinsic it returns, except the ledgered cards` before the repair was written. Claude-Session: https://claude.ai/code/session_01611D6ZaRaMmwTNQmSbk8MH Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8571
What changed
packages/components/src/custom/empty.tsx—EmptyDescriptionnow declaresReact.ComponentPropsof"div", the element it has always rendered, instead ofReact.ComponentPropsof"p". One token; the element is unchanged by ruling (option 1). A short comment at the declaration records why.packages/components/src/__tests__/empty-description-props-name-the-element-8571.test.tsx— the guard (details below)..changeset/empty-description-props-name-the-element-8571.md—@object-ui/components: patch. Declaration-only change to the published.d.ts; rendered output unchanged; no call site's type-check can move (measured, below).skip-changesetwas not applied: in this repo it is a phantom label.Provenance, by sha: the
"p"annotation over adiventered this tree inb1fd1a80f(2026-01-28, "Refactor component structure and add new custom components") and is verbatim upstream shadcn'sempty.tsx(fetched fromraw.githubusercontent.com, same shape at its line 70). The file was last touched by1570eac37(the base-class repair for objectui#8525); this PR is built one411c3e58and re-reads the merged file.Siblings — measured, all consistent
Empty,EmptyHeader,EmptyMedia,EmptyTitle,EmptyContenteach declare"div"and return adiv;EmptyValuedeclares"span"and returns aspan.EmptyDescriptionwas the only member of the family whose declaration and element disagreed. Nothing else in the file changes.Call-site census on
origin/main(e411c3e58)Opening tags outside
empty.tsx:EmptyDescription43,EmptyTitle42,EmptyHeader1,EmptyMedia1,EmptyContent0, across 46 files. No site passes aref; the only attributes beyondclassNameare onedata-testid(HomePage.tsx:421). A parser-backed scan of everyEmptyDescription/EmptyTitlebody found zero block-level children (85 sites; the scanner was lit-controlled on a syntheticdivchild). So the census does not indicate the element should become ap— and per the ruling it was not taken either way; the element stays adivand the last test below pins that deliberately. (Brief note: the card says PR #8569 took the count "from a handful to twenty-odd";origin/mainalready carries 43EmptyDescriptionsites without it — #8569 has not landed onmainas ofe411c3e58.)The measurement that changed the instrument
The card expected
type-check(both programs) to be the instrument, with a "div-only prop accepted, nonsense prop refused" pin. I ran that matrix before writing the pin — TypeScript 6.0.3,@types/react19.2.18, React 19.2.8, one narrow program extendingtsconfig.test.jsonper leg,empty.tsxmutated on disk with the mutation proven by count and restored by state after each leg (hash equal to the HEAD blob,git diff HEADempty):"p"(the defect)currentTargetrefused as an input)"div"(the fix)"p"leg — the same two controls"div"intersected with"p"(caricature)any(caricature)IsAnyred, implicit-any on handlers, and the nonsense-prop@ts-expect-errorgoes unused (TS2578)What that means:
EqualofReact.ComponentPropsof"div"and of"p"is TRUE under this compiler.lib.domdeclaresHTMLDivElementandHTMLParagraphElementwith the same members (a deprecatedalignplus the listener overloads), so under structural identity they are one type — and so are the two props types, and even their intersection. Ap-typed ref is accepted by the"div"form and adiv-typed ref by the"p"form;keyofis identical; there is nodiv-only prop in@types/reactat all (HTMLAttributesis one interface for every element). The"p"→"div"change is therefore invisible totscin every program, and to vitest through the component alone. Only theanycaricature is type-observable.So the guard reads the SOURCE and ties it to the DOM:
src/custom/whose single parameter's annotation namesReact.ComponentPropsof a string literal and whose root return is an intrinsic JSX element, the literal must equal the tag (compiler parser, no type-checker). A member may name exactly ONE intrinsic — that is what refuses the intersection caricature.anydrops the member out of the judged population, and the family enumeration (all sevenEmpty*members must be judged) is what refuses that.tagNamecompared with the literal its source names — the syntactic reading is checked against the real element.EmptyDescriptionrenders adivwithdata-slot="empty-description"— the ruling pinned, so a future real-pchange is a deliberate edit with its own card.tsc -p tsconfig.test.json: identity of each member's props with the element's props,IsAnyfalse, a nonsense prop under@ts-expect-error. Documented in the test as unable to see"p"vs"div"; it exists to refuseanyand to spell the contract a consumer reads.any, a variance intersection, anasChild-styleComproot, and the bareComponentPropsspelling in memory and asserts each reads as intended.The sweep also found one other disagreement under
src/custom/:kbd.tsxKbdGroupdeclares"div"and returns akbd(upstream shadcn's shape too). It is ledgered in the test as a ratchet with its own decision pending — see "Out of scope" — not fixed here: thepreasoning in this card's ruling does not transfer to akbd, andHTMLDivElementandHTMLElementare NOT identical types, so that one may be type-observable and needs its own ruling.Caricature matrix against the committed fix (run, not predicted)
Each leg mutated
empty.tsxon disk (mutation proven by counting the injected and removed text), ran the pin file under vitest plus the narrow test program undertsc, and restored by state under atrap ... EXIT INT TERMwith absolute paths:tsctest program"p"(defect)EmptyDescription: p -> div), family-source, family-renderdiv & p -> div), family-sourceany@ts-expect-errorp(option 2)div -> p), family-render, ruling pin (Pis notDIV)The option-2 leg's first attempt was voided and re-run: its on-disk proof used
grep -Fwith a multi-line pattern, which counts per line, so the proof mis-instrumented itself (the replacement had asserted exactly one anchor). The re-run proved the mutation with a Python count (injected=1 anchor_remaining=0) before measuring. Every leg's assertion was observed to fail in the leg it was written for.Verification
pnpm --filter @object-ui/components run type-check(both programs) — green.--listFilesontsconfig.test.json: the pin file is in the program (1803 files),custom/empty.tsxis in both programs, zeropackages/components/distentries; the pin file is absent from the source program astsconfig.jsonexcludes__tests__, so the type half is checked by the test program only. Dependency closure built first (turbo run build --filter='@object-ui/components^...', 7 tasks).pnpm exec vitest run packages/components/— 244 files, 2255 tests passed (SUITE_EXIT=0), run after the matrix restored the tree.pnpm exec vitest run packages/components/src/__tests__/empty-description-props-name-the-element-8571.test.tsx— 7 passed.projectService/parserOptions.projectineslint.config.js), so this diff cannot move any untouched file's verdict;--print-configshows 118 / 117 rules apply to the two changed.ts(x)files;--format jsonover those two files: 2 files, 0 errors, 0 warnings, at6eb1a930b.check-changeset-presence,check-changeset-no-major,check-changeset-fixed,check-control-bytes,check-phantom-dependencies,check-vi-mock-inherit,check-vi-mock-specifiers,check-package-self-import,check-published-tsconfig-tooling-exclude,check-unreferenced-sources,check-type-check-coverage,check-governed-queue-guard --test(NOT GOVERNED). A Python scanner with a lit control found zero zero-width or control code points in the three changed files.turbo ls --affectedagainst the base lists 31 packages (components and every consumer). Declared narrowing: only@object-ui/componentswas tested locally. Invariance: the identity measurement above (Equalof the two props types is TRUE on the same compiler) means no downstream program can observe the change; the full farm is CI's run.Out of scope — handed to the PM, not filed
packages/components/src/custom/kbd.tsx—KbdGroupdeclaresReact.ComponentPropsof"div"and returns akbd. Same defect class; direction needs its own ruling (type follows element, or element becomes adiv). Not filed by this seat: the repo-scoped REST read returned 403 for this session, and MCPsearch_issuesreturnedtotal_count: 0for the control wordEmptyDescription(objectui#8571's own title carries it), so its zero forKbdGroupis not a reading. Ledgered in the guard as a ratchet line that takes the card number once one exists.Session:
https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S🤖 Generated with Claude Code
https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
Generated by Claude Code