Skip to content

Commit 53bf11b

Browse files
authored
fix: Added children prop to make it compatible with React 18 (#158)
## Summary React 18 required `children` prop to be explicitly defined. This PR fixes this to make the React SDK work with React 18. https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#updates-to-typescript-definitions ## Test Plan All existing tests pass ## Issues #156
1 parent 418bb2f commit 53bf11b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Bug fixes
11+
- addresses issues [#152](https://github.com/optimizely/react-sdk/issues/152) and [#134](https://github.com/optimizely/react-sdk/issues/134): Gracefully returns pessimistic default values when hooks fail instead of throwing an error.
12+
- fixed issue [#156](https://github.com/optimizely/react-sdk/issues/156) - Added children prop to make the SDK compatible with React 18([#158](https://github.com/optimizely/react-sdk/pull/158)).
13+
814
## [2.8.1] - March 7, 2022
915

1016
### Enhancements
1117
- fixed issue [#49](https://github.com/optimizely/react-sdk/issues/49): Return type of `createInstance` was `OptimizelyReactSDKClient` which is the implementation class. Changed it to the `ReactSDKClient` interface instead ([#148](https://github.com/optimizely/react-sdk/pull/148)).
1218

1319
- fixed issue [#121](https://github.com/optimizely/react-sdk/issues/121):`ActivateListenerPayload` and `TrackListenerPayload` types were exported from `@optimizely/optimizely-sdk` but were missing from `@optimizely/react-sdk` exports. ([#150](https://github.com/optimizely/react-sdk/pull/150)).
1420

15-
- addresses issues [#152](https://github.com/optimizely/react-sdk/issues/152) and [#134](https://github.com/optimizely/react-sdk/issues/134): Gracefully returns pessimistic default values when hooks fail instead of throwing an error.
16-
1721
### Bug fixes
1822
- Fixed issue [#134](https://github.com/optimizely/react-sdk/issues/134) of the React SDK crashing when the internal Optimizely client returns as a null value. [PR #149](https://github.com/optimizely/react-sdk/pull/149)
1923

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"build": "rm -rf dist/ && node ./scripts/build.js",
2323
"lint": "tsc --noEmit && eslint 'src/**/*.{js,ts,tsx}' --quiet --fix",
2424
"test": "jest --silent",
25-
"prepublishOnly": "npm run test && npm run build"
25+
"prepublishOnly": "npm run test && npm run build",
26+
"prepare": "npm run build"
2627
},
2728
"publishConfig": {
2829
"access": "public"

src/Provider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ interface OptimizelyProviderProps {
3030
user?: Promise<UserInfo> | UserInfo;
3131
userId?: string;
3232
userAttributes?: UserAttributes;
33+
children?: React.ReactNode;
3334
}
3435

3536
interface OptimizelyProviderState {

0 commit comments

Comments
 (0)