Skip to content

feat(react 19): update react to 19, testing libraries deps to latest …#819

Closed
leefreemanxyz wants to merge 3 commits intoauth0:mainfrom
leefreemanxyz:feat/react-19-compat
Closed

feat(react 19): update react to 19, testing libraries deps to latest …#819
leefreemanxyz wants to merge 3 commits intoauth0:mainfrom
leefreemanxyz:feat/react-19-compat

Conversation

@leefreemanxyz
Copy link
Contributor

@leefreemanxyz leefreemanxyz commented Dec 6, 2024

…and fix broken tests. Closes #818

By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.

Description

The purpose of this PR is to enable compatability with React 19 without the need for legacy-peer-deps flag in npm.

Updating to React 19 had further knock on effects that required updating testing libraries dependencies. This caused significant breakage in the unit tests due to deprecated functionality being used, which have now been fixed and should be passing.

Testing

The unit tests have been adjusted to be passing, otherwise all behaviour should be identical - I have not tested/run the examples.

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • [?] All active GitHub checks for tests, formatting, and security are passing
  • [X ] The correct base branch is being used, if not the default branch

@leefreemanxyz leefreemanxyz requested a review from a team as a code owner December 6, 2024 15:19
@tusharpandey13
Copy link
Contributor

Acknowledged, @leefreemanxyz, we will take a look and merge if it looks fine.

@FrankBurmo
Copy link

Do you have an ETA for when 2.2.5 (or what the next release will be named) will be released with support for react 19?

@tusharpandey13
Copy link
Contributor

tusharpandey13 commented Dec 23, 2024

Hi @FrankBurmo, you can expect a release for react 19 support by January 2025 latest.

@leefreemanxyz
Copy link
Contributor Author

I've removed the explicit JSX.Element typing to let the types flow as they were breaking the build in CI.

* Render a message to show that the user is being redirected to the login.
*/
onRedirecting?: () => JSX.Element;
onRedirecting?: () => React.JSX.Element;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would normally type this with React.ReactNode, but that causes breakage elsewhere (and trying to fix it leads me down a TypeScript rabbithole)

@JChampigny
Copy link

@tusharpandey13 any news/ETA on this?

@tusharpandey13 tusharpandey13 mentioned this pull request Jan 15, 2025
4 tasks
@tusharpandey13
Copy link
Contributor

Closing this as #823 is up, containing your commits @leefreemanxyz

@tusharpandey13 tusharpandey13 mentioned this pull request Jan 20, 2025
4 tasks
tusharpandey13 added a commit that referenced this pull request Jan 21, 2025
This change enables React 19 support for `auth0-react`
This change builds upon PR #819 by @leefreemanxyz 

### Changes
- Version bumps of related packages in package.json, package-lock.json
update.
- Updated tests to use the new version of packages.
- Added handling for an edge case where error was not thrown if popup
was closed in `loginWithPopup`.
- Updated sample code to use React 19.
- Linting changes.

#### Commits
- **feat(react 19): update react to 19, testing libraries deps to latest
and fix broken tests**
- **chore: update @types/react and @types/react-dom to version 19.0.0**
- **refactor: remove explicit return types for functional components in
tests and providers**
- **add explicit type annotations for React.JSX.Element**
- **handle popup closed error not thrown**
- **update example code**
- **update tests**
- **package json changes**

### Testing
*PASSING*
```log
=============================== Coverage summary ===============================
Statements   : 100% ( 166/166 )
Branches     : 100% ( 72/72 )
Functions    : 100% ( 41/41 )
Lines        : 100% ( 158/158 )
================================================================================

Test Suites: 8 passed, 8 total
Tests:       81 passed, 81 total
Snapshots:   0 total
Time:        4.995 s
Ran all test suites.
```
- [x] This change adds test coverage for new/changed/fixed functionality

### Checklist

- [x] I have added documentation for new/changed functionality in this
PR or in auth0.com/docs
- [x] All active GitHub checks for tests, formatting, and security are
passing
- [x] The correct base branch is being used, if not the default branch
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.

React 19 compatibility

4 participants