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

Request to Address Compatibility Issues with React #741

Closed
shujieali opened this issue Jan 3, 2024 · 4 comments · Fixed by #742
Closed

Request to Address Compatibility Issues with React #741

shujieali opened this issue Jan 3, 2024 · 4 comments · Fixed by #742
Assignees
Labels
bug Something isn't working

Comments

@shujieali
Copy link
Contributor

shujieali commented Jan 3, 2024

Observed behavior

The current version of the react-sdk relies on a React version >=18.0.0. However, there are compatibility concerns for applications that might be using older versions of React, potentially causing dependency warnings or errors. Since hooks were introduced in react 16.8.0 so we should be putting the minimum version to 16.8.0

Expected Behavior

The package should maintain compatibility with applications using older versions of React while also supporting the latest versions without compromising functionality.

Steps to reproduce

  1. create a react project using react 16.8.0, node 14, npm 6.X.X
  2. install @openfeature/react-sdk

Observe the following warning:

npm WARN @openfeature/react-sdk@0.0.5-experimental requires a peer of react@>=18.0.0 but none is installed. You must install peer dependencies yourself.
@beeme1mr
Copy link
Member

beeme1mr commented Jan 3, 2024

Hey @shujieali, I've assigned this issue to @toddbaert. He was working on adding support for the React suspense API which relies on some changes added in React 18 I believe. However, I understand that people may not but using that version of React yet. Perhaps there's a way to add support for suspense without making it incompatible with React 16.8.

@shujieali
Copy link
Contributor Author

@beeme1mr Thank you ! React suspense is indeed an amazing addition, but we should be careful in defining minimum requirements for a package. i'll have a look on the suspense implementation and see what can be done !

@shujieali shujieali changed the title Request to Address Compatibility Issues with React Hooks Request to Address Compatibility Issues with React Jan 4, 2024
@beeme1mr
Copy link
Member

beeme1mr commented Jan 4, 2024

That would be great!

@toddbaert
Copy link
Member

@shujieali relevant comment: #742 (comment).

It might be that the suspense features we have work fine with 16.8.0. I just want to test them. If they do work fine, or there's only minor changes or differences in behavior, I'm fine with this change. I'll confirm next week.

toddbaert added a commit that referenced this issue Jan 11, 2024
…> 16.8.0 (#742)

## This PR fix the npm warning when installing @openfeature/react-sdk in
application using react version < 18

| Package   | Change   | Passing   | Confidence   |
|-----------|----------|-----------|--------------|
| [react](https://github.com/facebook/react) |
[18.0.0](https://github.com/facebook/react/releases/tag/v18.0.0) ->
[16.8.0](https://github.com/facebook/react/releases/tag/v16.8.0) | True
| High |

Fixes #741

### How to test
1. create a react project using react 16.8.0, node 14, npm 6.X.X
2. install @openfeature/react-sdk
3. Observe no install warning
4. use `useFeatureFlag` in application as per documentation with no
issue.

Signed-off-by: Shujaat Ali <dr.shujaat_ali@hotmail.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants