Skip to content

fix: upgrade Radix UI packages and tighten asChild prop types#28416

Open
himself65 wants to merge 8 commits intocalcom:mainfrom
himself65:fix/radix-asChild-guard
Open

fix: upgrade Radix UI packages and tighten asChild prop types#28416
himself65 wants to merge 8 commits intocalcom:mainfrom
himself65:fix/radix-asChild-guard

Conversation

@himself65
Copy link

@himself65 himself65 commented Mar 13, 2026

Summary

  • Upgrade all @radix-ui/* packages to latest versions (React 19 compatible)
  • Tighten children/trigger/fallback prop types from ReactNode to ReactElement on components that pass them to Radix's asChild

Problem

Radix UI v1.0.x internally accesses element.ref, which was removed in React 19. This produces the warning:

Accessing element.ref was removed in React 19. ref is now a regular prop.

Additionally, several components accept ReactNode for props that get passed to Radix's asChild (which calls React.cloneElement). Passing null, strings, or fragments crashes at runtime.

Changes

Radix upgrades (apps/web/package.json, packages/ui/package.json):

Package Before After
react-tooltip 1.0.6 1.2.8
react-dialog 1.0.4 1.1.15
react-popover 1.0.6 1.1.15
react-dropdown-menu 2.0.5 2.1.16
react-avatar 1.1.3 1.1.11
react-checkbox 1.0.4 1.3.3
react-select 0.1.1 2.2.6
+ 8 more latest

Type fixes (4 files):

  • Tooltip.tsx: children: ReactNodeReactElement
  • TableActions.tsx: actionTrigger?: ReactNodeReactElement
  • AnimatedPopover.tsx: Trigger?: ReactNodeReactElement
  • Avatar.tsx: fallback?: ReactNodeReactElement

Missing dep: Added @radix-ui/react-label (was previously hoisted transitively)


Open with Devin

@CLAassistant
Copy link

CLAassistant commented Mar 13, 2026

CLA assistant check
All committers have signed the CLA.

cubic-dev-ai[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

@sahitya-chandra sahitya-chandra marked this pull request as ready for review March 14, 2026 13:53
@sahitya-chandra sahitya-chandra requested review from a team as code owners March 14, 2026 13:53
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Mar 14, 2026
Copy link
Member

@sahitya-chandra sahitya-chandra left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution

LGTM

@sahitya-chandra sahitya-chandra added ready-for-e2e run-ci Approve CI to run for external contributors labels Mar 14, 2026
@sahitya-chandra sahitya-chandra dismissed their stale review March 14, 2026 14:04

checks failed

Copy link
Member

@sahitya-chandra sahitya-chandra left a comment

Choose a reason for hiding this comment

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

@himself65 CI checks failed, Can you please fix them?

himself65 and others added 7 commits March 16, 2026 10:12
Radix UI's `asChild` uses `Slot` which calls `React.cloneElement` on
children. This crashes when children is null, undefined, a string, or
a fragment. The root cause is that these props were typed as
`React.ReactNode` (which allows primitives) but `asChild` requires
exactly one `React.ReactElement`.

Changed types:
- Tooltip: `children: ReactNode` → `ReactElement`
- TableActions: `actionTrigger?: ReactNode` → `ReactElement`
- AnimatedPopover: `Trigger?: ReactNode` → `ReactElement`
- Avatar: `fallback?: ReactNode` → `ReactElement`

This makes TypeScript catch invalid callers at compile time instead
of crashing at runtime.
Radix UI v1.0.x uses `element.ref` which was removed in React 19,
causing "Accessing element.ref was removed in React 19" warnings.
Upgrade all @radix-ui packages to latest versions which use
`React.forwardRef` properly and support React 18 + 19.

Packages upgraded:
- react-tooltip: 1.0.6 → 1.2.8
- react-popover: 1.0.6 → 1.1.15
- react-dialog: 1.0.4 → 1.1.15
- react-dropdown-menu: 2.0.5 → 2.1.16
- react-avatar: 1.1.3 → 1.1.11
- react-collapsible: 1.0.3 → 1.1.12
- react-hover-card: 1.0.7 → 1.1.15
- react-checkbox: 1.0.4 → 1.3.3
- react-portal: 1.0.4 → 1.1.10
- react-select: 0.1.1 → 2.2.6
- react-slider: 1.2.2 → 1.3.6
- react-switch: 1.1.0 → 1.2.6
- react-toggle-group: 1.0.4 → 1.1.11
- react-radio-group: 1.1.3 → 1.3.8
- react-id: 1.0.1 → 1.1.1
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Remove Fragment wrapper in Avatar fallback for asChild compatibility
- Revert AnimatedPopover Trigger type to ReactNode (not passed to asChild)
- Add missing @radix-ui/react-dropdown-menu and react-tooltip deps to @calcom/ui
- Fix children type in Tooltip wrapper components to ReactElement
@himself65 himself65 force-pushed the fix/radix-asChild-guard branch from 87001c0 to fd3f267 Compare March 16, 2026 17:12
@sahitya-chandra sahitya-chandra added run-ci Approve CI to run for external contributors and removed run-ci Approve CI to run for external contributors labels Mar 17, 2026
Copy link
Member

@sahitya-chandra sahitya-chandra left a comment

Choose a reason for hiding this comment

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

LGTM

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

Labels

community Created by Linear-GitHub Sync ready-for-e2e run-ci Approve CI to run for external contributors size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants