Skip to content

fix(base-ui): HoverCard delay props break the build on a Base UI project - #473

Open
hamchowderr wants to merge 1 commit into
vercel:mainfrom
hamchowderr:fix/base-ui-hovercard-delay-props
Open

fix(base-ui): HoverCard delay props break the build on a Base UI project#473
hamchowderr wants to merge 1 commit into
vercel:mainfrom
hamchowderr:fix/base-ui-hovercard-delay-props

Conversation

@hamchowderr

Copy link
Copy Markdown

Fixes the openDelay / closeDelay half of #446, and covers two files that issue doesn't mention.

The problem

On a shadcn Base UI project (shadcn init --base base), HoverCard resolves to Base UI's PreviewCard, which has neither openDelay nor closeDelay. Four elements name those props in a typed position, so tsc fails before anything renders:

File Component Errors
attachments.tsx AttachmentHoverCard 3
prompt-input.tsx PromptInputHoverCard 3
inline-citation.tsx InlineCitationCard 1
context.tsx Context 1
attachments.tsx(375,3): error TS2339: Property 'openDelay' does not exist on type 'Props<unknown>'.
attachments.tsx(376,3): error TS2339: Property 'closeDelay' does not exist on type 'Props<unknown>'.
inline-citation.tsx(53,14): error TS2322: Type '{ ...; openDelay: number; }' is not assignable to type 'IntrinsicAttributes & Props<unknown>'.

#446 reports this for attachments and prompt-input; inline-citation and context have the same defect and aren't mentioned there.

The fix

Each component spreads a NO_DELAY object instead of naming the props:

const NO_DELAY = {
  closeDelay: 0,
  openDelay: 0,
} as unknown as ComponentProps<typeof HoverCard>;

export const InlineCitationCard = (props: InlineCitationCardProps) => (
  <HoverCard {...NO_DELAY} {...props} />
);

Radix keeps the zero-delay behaviour, Base UI ignores the extra keys rather than failing to compile, and a caller's own props still win because they spread last.

On the two that took them as props

AttachmentHoverCard and PromptInputHoverCard previously destructured openDelay = 0, closeDelay = 0. Their prop type is ComponentProps<typeof HoverCard>, so on Radix those keys came from HoverCard's own type and callers can still pass them — the defaults are unchanged. On Base UI the keys were never in the type, so nothing that compiled before stops compiling.

Scope

This does not address the rest of #446. The four BaseUIEvent<…> handler-signature errors in prompt-input.tsx are a real typing change and are deliberately left alone, as is the ButtonProps mismatch in plan.tsx.

Verification

  • tsc --noEmit in packages/elements: 56 errors before, 56 after — all pre-existing and in __tests__; none in these four files
  • vitest run: 950 tests across 46 files pass

🤖 Generated with Claude Code

On a shadcn Base UI project (`init --base base`), `HoverCard` resolves to Base
UI's PreviewCard, which has neither `openDelay` nor `closeDelay`. Four elements
name those props in a typed position, so `tsc` fails before anything renders:

  attachments.tsx      AttachmentHoverCard    3 errors
  prompt-input.tsx     PromptInputHoverCard   3 errors
  inline-citation.tsx  InlineCitationCard     1 error
  context.tsx          Context                1 error

  attachments.tsx(375,3): error TS2339: Property 'openDelay' does not exist on
    type 'Props<unknown>'.
  inline-citation.tsx(53,14): error TS2322: Type '{ ...; openDelay: number; }'
    is not assignable to type 'IntrinsicAttributes & Props<unknown>'.

Reported in vercel#446 for attachments and prompt-input; inline-citation and context
have the same defect.

Each component now spreads a NO_DELAY object rather than naming the props. Radix
keeps the zero-delay behaviour, Base UI ignores the extra keys instead of failing
to compile, and a caller's own props still win because they spread last.

AttachmentHoverCard and PromptInputHoverCard previously destructured
`openDelay = 0, closeDelay = 0` out of props. Their prop type is
`ComponentProps<typeof HoverCard>`, so on Radix those keys came from HoverCard's
own type and callers can still pass them — the defaults are unchanged. On Base UI
the keys were never in the type, so nothing that compiled before stops compiling.

This does not address the other Base UI failures in vercel#446 — the four
`BaseUIEvent<...>` handler-signature errors in prompt-input.tsx are a real typing
change and are left alone here.

Verified on both bases: `tsc --noEmit` error count in packages/elements is
unchanged (56 before, 56 after — all pre-existing, in __tests__), none in these
four files, and 950 tests across 46 files pass.
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@hamchowderr is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@hamchowderr

Copy link
Copy Markdown
Author

Verified on an actual Base UI project, since the repo's own suite runs on Radix and can't exercise this.

Scaffolded shadcn init --base base --preset nova (style base-nova, iconLibrary: lucide), installed the five affected elements straight from the published registry, and ran tsc --noEmit before and after applying this patch to the installed files.

Before — 15 errors:

7  prompt-input.tsx
3  context.tsx
3  attachments.tsx
1  plan.tsx
1  inline-citation.tsx

After — 7:

4  prompt-input.tsx
2  context.tsx
1  plan.tsx

All 8 openDelay / closeDelay errors are gone; attachments.tsx and inline-citation.tsx are clean. grep -c 'openDelay\|closeDelay' over the remaining errors returns 0.

The 7 survivors are the ones this PR deliberately doesn't touch:

No new errors introduced. On the Radix side, packages/elements typechecks with the same 56 pre-existing errors as main (all in __tests__), none in the four touched files, and all 950 tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant