Skip to content

feat: React 19 migration - 7#714

Merged
rohanchkrabrty merged 12 commits intomainfrom
migrate-react-19-7
Mar 24, 2026
Merged

feat: React 19 migration - 7#714
rohanchkrabrty merged 12 commits intomainfrom
migrate-react-19-7

Conversation

@rohanchkrabrty
Copy link
Contributor

@rohanchkrabrty rohanchkrabrty commented Mar 17, 2026

Summary

  • Removed forwardRef wrappers (Case A) from toggle and tooltip components — props now spread directly onto Base UI primitives
  • Converted const + forwardRef patterns to plain named function exports; removed ElementRef and forwardRef imports
  • This is the final batch — all components in the migration list are now fully migrated to React 19

Components migrated:

  • toggle
  • tooltip

Summary by CodeRabbit

  • Dependencies

    • Updated minimum React requirement to version 19 (no longer supports React 18)
  • Refactor

    • Improved type imports across components for better code consistency and maintainability
    • Simplified internal component implementations while maintaining existing functionality

@vercel
Copy link

vercel bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview, Comment Mar 24, 2026 7:27am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR is a React 19 migration effort that removes forwardRef wrappers from multiple components, replaces namespace imports with direct type imports from React, updates prop typing patterns to use ComponentProps variants, and narrows the package's React peer dependencies to version 19 only.

Changes

Cohort / File(s) Summary
Test Files - Type Import Updates
alert-dialog/__tests__/alert-dialog.test.tsx, dialog/__tests__/dialog.test.tsx, drawer/__tests__/drawer.test.tsx, popover/__tests__/popover.test.tsx
Replaced default React imports with type-only imports for React type exports (ReactNode, ReactElement), removing unused runtime React namespace references.
Test Files - Hook & Prop Type Updates
switch/__tests__/switch.test.tsx, tabs/__tests__/tabs.test.tsx
Updated hook imports to use named useState import and switched prop type derivation from ComponentPropsWithoutRef to ComponentProps.
Component - forwardRef Removals (Number Field)
number-field/number-field.tsx
Converted six forwardRef-wrapped components (NumberFieldRoot, NumberFieldGroup, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, NumberFieldScrubArea) to plain functions, removing ref forwarding and ElementRef typing; updated context provisioning pattern.
Component - forwardRef Removals (Toggle & Toolbar)
toggle/toggle.tsx, toolbar/toolbar.tsx
Replaced forwardRef-based implementations with plain function components, removing ref parameter handling while preserving className composition and child rendering logic.
Component - forwardRef Removal (Tooltip)
tooltip/tooltip-content.tsx, tooltip/tooltip-misc.tsx
Converted TooltipContent to named function export and TooltipTrigger to plain function, removing forwardRef and ref forwarding while retaining render structure and behavior.
Component - Prop Type Updates
command/command.tsx, context-menu/context-menu-misc.tsx
Updated prop typing from React.ComponentProps/HTMLAttributes to ComponentProps variants; switched Command from radix-ui to @base-ui/react Dialog primitive and added displayName for CommandDialog.
Component - Import Cleanup
container/container.tsx
Removed unused React type imports (HTMLAttributes, PropsWithChildren), keeping only ComponentProps.
Configuration
package.json
Narrowed React peer dependencies (react, react-dom, @types/react) from `^18

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • feat: add Toolbar #701: Modifies toolbar/toolbar.tsx alongside this PR; both change Toolbar component implementation from forwardRef-based to plain functions.
  • feat: add Toggle component #696: Directly related as this PR refactors toggle/toggle.tsx (removing forwardRef from ToggleRoot/ToggleGroup) that was introduced in that PR.
  • feat: add NumberField component #698: This PR includes edits to number-field/number-field.tsx, removing forwardRef wrappers and modifying prop typings on the same component.

Suggested reviewers

  • rohilsurana
  • rsbh
  • paanSinghCoder

Poem

🐰 React nineteen calls, we heed the way,
Stripping forwardRef wraps—old code at bay!
Type imports bloom where namespaces once stood,
Plain functions dance where refs misunderstood. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: React 19 migration - 7' directly matches the primary objective: completing the final batch of React 19 component migrations, specifically the toggle and tooltip components.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migrate-react-19-7

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rohanchkrabrty rohanchkrabrty changed the title chore: React 19 migration — batch 7 (toggle → tooltip) feat: React 19 migration — 7 Mar 17, 2026
@rohanchkrabrty rohanchkrabrty changed the title feat: React 19 migration — 7 feat: React 19 migration - 7 Mar 17, 2026
Base automatically changed from migrate-react-19-6 to main March 24, 2026 06:42
@rohanchkrabrty rohanchkrabrty merged commit eda5a9e into main Mar 24, 2026
4 of 5 checks passed
@rohanchkrabrty rohanchkrabrty deleted the migrate-react-19-7 branch March 24, 2026 07:28
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.

Modernize React APIs and adopt current best practices

2 participants