Skip to content

refactor(ui): align CommandDialog with upstream composition contract#5027

Open
ephraimduncan wants to merge 1 commit into
mainfrom
refactor/command-dialog-upstream-contract
Open

refactor(ui): align CommandDialog with upstream composition contract#5027
ephraimduncan wants to merge 1 commit into
mainfrom
refactor/command-dialog-upstream-contract

Conversation

@ephraimduncan

@ephraimduncan ephraimduncan commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What

Realigns CommandDialog in the vendored command component (packages/ui/src/components/ui/{base,radix}/command.tsx) with shadcn upstream's current composition contract:

  • showCloseButton default: truefalse
  • Removed the internal <Command className="[&_[cmdk-…]]…"> auto-wrap; children now render directly inside DialogContent
  • Props type: Omit<React.ComponentProps<typeof Dialog>, "children"> & { …; children: React.ReactNode } (children now required)

Why

Registry items declare bare "command" registryDependencies, which the shadcn CLI resolves against the official upstream registry — not our vendored copies. Upstream changed CommandDialog to render children directly (canonical usage passes an explicit <Command> child). A user following current shadcn examples against our vendored file gets nested cmdk roots (<Command> inside the auto-wrapped <Command>).

Behavior change (old → new contract): callers must now pass an explicit <Command> child and opt into the close button. No in-repo consumer uses CommandDialog (only definitions + exports), and templates/minimal does not ship command.tsx, so nothing needed migration.

Deliberately deferred drift

Only the CommandDialog contract is synced. Upstream's InputGroup-based CommandInput and the CommandItem checked-state indicator are not copied — upstream's version depends on input-group, which has no Base twin in this repo. Upstream's cn-* classes are also skipped (this repo doesn't use that class system); the existing "overflow-hidden p-0" is kept.

Verification

  • grep CommandDialog across packages/apps/templates/examples → only definitions/exports
  • pnpm sync-templates ✓, pnpm lint ✓, pnpm -C apps/registry build ✓, packages/ui tsc --noEmit
  • packages/ui is private → no changeset

Review in cubic

@ephraimduncan
ephraimduncan requested a review from a team July 17, 2026 18:41
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 51a64b5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rupic-app rupic-app Bot added stage/needs-review No reviews yet; waiting for a maintainer pkg/ui Changes a package under packages/ R1 Actionable, normal priority type/refactor Code refactor, no behavior change labels Jul 17, 2026
@claude

claude Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Claude finished @ephraimduncan's task in 2m 16s —— View job


Review

Clean, minimal, deletion-only realignment. Both variant files end up byte-identical apart from the flavor-specific dialog import, which matches the parallel radix//base/ convention. No critical issues found.

Verified claims

  • No in-repo consumers: grep CommandDialog across the repo returns only the two definitions and their export lists — nothing needed migration. ✓
  • No changeset needed: packages/ui has "private": true, so it is exempt per repo policy. The changeset-bot warning can be ignored. ✓
  • Registry rationale holds: our registry has no command item of its own — apps/registry/src/registry.ts:581 (model-selector) declares a bare "command" registryDependency, which the shadcn CLI resolves against the official upstream registry. So end users were already receiving upstream's new contract; the vendored copy was the stale one. This PR closes that gap rather than creating one. ✓
  • Consistency win: the radix variant previously omitted children from its extra props while the base variant declared it optional; both now carry the same required declaration.
  • CI: all checks were still in progress at review time with no failures; the diff is type-safe by inspection (Omit + required children re-add is well-formed against both Dialog flavors).

Notes (non-blocking)

  • Upstream contract not independently verified from this sandbox — network fetch of shadcn's command.tsx requires approval I don't have. The claimed upstream shape (showCloseButton = false, direct children in DialogContent, required children via Omit) is consistent with upstream's current composition contract as I know it, but rests on the author's verification.
  • The Omit<…, "children"> is technically redundant once the intersection re-adds children as required, but keeping it matches upstream verbatim, which is the point of the PR — no change requested.
  • DialogHeader rendered outside DialogContent is a pre-existing upstream quirk, untouched by this diff — correctly left alone.
  • The "Deliberately deferred drift" section (skipping InputGroup-based CommandInput because input-group has no Base twin) is a reasonable scoping call and is well documented in the PR body.

Simplify

The simplification pass found no issues — the PR is itself a simplification (it deletes an abstraction layer), introduces no new state, effects, or duplication, and the only candidate nitpick (the redundant Omit) was rejected because removing it would break upstream alignment. Code looks clean.


  • Gather context (CI status, previous reviews, diff)
  • Review code changes
  • Verify claims (no in-repo consumers, registry references, private package)
  • Collect simplify agent findings
  • Post final review

@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "refactor(ui): align CommandDialog with u..." | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@rupic-app rupic-app Bot added stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed and removed stage/needs-review No reviews yet; waiting for a maintainer labels Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/ui Changes a package under packages/ R1 Actionable, normal priority stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed type/refactor Code refactor, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant