Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce support for react v18 (FE-6015) #7132

Closed
wants to merge 14 commits into from
Closed

Conversation

Parsium
Copy link
Contributor

@Parsium Parsium commented Dec 16, 2024

Proposed behaviour

  • Introduce compatibility with React v18
  • Upgrade Storybook to v8.4.7
  • BREAKING CHANGE - Upgrade react-dnd and react-dnd-backend-html5 to v16 - this is required for React v18 support

Current behaviour

  • Carbon only supports React v17

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

@Parsium Parsium self-assigned this Dec 16, 2024
@Parsium Parsium changed the title React 18 feat: introduce support for react v18 Dec 16, 2024
@Parsium Parsium changed the title feat: introduce support for react v18 feat: introduce support for react v18 (FE-6015) Dec 16, 2024
BREAKING CHANGE: Both packages are now ESM-only, which may affect tools like Jest
that run your project code in a Node.js environment. Adjust your bundler configuration
to handle ESM code if issues arise.
BREAKING CHANGE: `axe-core` is no longer a public dependency. Its
previous exposure as one was unintentional, and has now been corrected.
@quinnturner
Copy link

quinnturner commented Dec 17, 2024

This is exciting 🥳

Question: is the hope that the peerDependency will be set to ^17 || ^18 || ^19? I am surprised that this PR suggests that ^17 is still supported, given that peer dependencies like DnD are only compatible with specific react versions. There are a lot of goodies in React 19 (I am most excited about the compiler!), and the lift seems to be much less significant from 18 -> 19 than 17 -> 18. Would it be too much also to support ^19 in a follow-up release? 😄

EDIT: I think I am wrong. react-dnd is not listed as a peer dependency currently (maybe it should be?), and the consumers of this package can specify the required version they want. Carbon can probably technically support both, which is great news.

@Parsium
Copy link
Contributor Author

Parsium commented Dec 17, 2024

This is exciting 🥳

Question: is the hope that the peerDependency will be set to ^17 || ^18 || ^19? I am surprised that this PR suggests that ^17 is still supported, given that peer dependencies like DnD are only compatible with specific react versions. There are a lot of goodies in React 19 (I am most excited about the compiler!), and the lift seems to be much less significant from 18 -> 19 than 17 -> 18. Would it be too much also to support ^19 in a follow-up release? 😄

EDIT: I think I am wrong. react-dnd is not listed as a peer dependency currently (maybe it should be?), and the consumers of this package can specify the required version they want. Carbon can probably technically support both, which is great news.

Hi @quinnturner 👋🏼

At the moment, we're focused on React 18 support due to team capacity constraints. We've reviewed some of the breaking changes introduced in React 19 and identified areas of tech debt that need attention before we can fully support it. Key challenges include:

  • Prop type support - Carbon generates prop types for legacy projects that don't utilise TypeScript. We'll need to evaluate the impact of removing this or consider an interim solution for storing type information.
  • Removal of defaultProps in all functional components - This change will require migrating away from styled-components v4, which is already part of our roadmap.

That said, we're eager to support React 19 soon, especially since we're currently two major versions behind. As part of that effort, we're currently experimenting with a replacement for react-dnd (ticket FE-6907). After releasing support for React 18, we'll be focusing on major refactoring efforts to tackle our remaining tech debt, including migrating away from styled-components@v4.

If you have any follow-up questions, feel free to reach out to us in our #carbon slack channel 😄

@Parsium Parsium closed this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants