Skip to content

Commit

Permalink
fix: [FFM-12209]: bump version from 1.14.0 to 2.0.0 (#23)
Browse files Browse the repository at this point in the history
- fix error encounered after upgrade react-native to v0.76
  • Loading branch information
Kira-Jennings authored Nov 20, 2024
1 parent b9cb73e commit a4d1760
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function MultipleFeatureFlags() {
By default, the React Client SDK will block rendering of children until the initial load of Feature Flags has completed.
This ensures that children have immediate access to all Flags when they are rendered. However, in some circumstances it
may be beneficial to immediately render the application and handle display of loading on a component-by-component basis.
The React Client SDK's asynchronous mode allows this by passing the optional `async` prop when connecting with the
The React Client SDK's asynchronous mode allows this by passing the optional `asyncMode` prop when connecting with the
`FFContextProvider`.


Expand All @@ -112,7 +112,7 @@ It includes the flag, variation, and whether the SDK was still initializing (`lo

This can happen when:

1. Using `async` mode without `cache` or `initialEvaluations` and where the SDK is still initializing.
1. Using `asyncMode` mode without `cache` or `initialEvaluations` and where the SDK is still initializing.
2. The flag identifier is incorrect (e.g., due to a typo).
3. The wrong API key is being used, and the expected flags are not available for that project.

Expand Down Expand Up @@ -232,7 +232,7 @@ using the `useFeatureFlag` and `useFeatureFlags` hooks and `withFeatureFlags`
your Harness Feature Flags account, and the `target`. You can think of a `target` as a user.

The `FFContextProvider` component also accepts an `options` object, a `fallback` component, an array
of `initialEvaluations`, an `onError` handler, and can be placed in [Async mode](#Async-mode) using the `async` prop.
of `initialEvaluations`, an `onError` handler, and can be placed in [Async mode](#Async-mode) using the `asyncMode` prop.
The `fallback` component will be displayed while the SDK is connecting and fetching your flags. The `initialEvaluations`
prop allows you pass an array of evaluations to use immediately as the SDK is authenticating and fetching flags.
The `onError` prop allows you to pass an event handler which will be called whenever a network error occurs.
Expand All @@ -245,7 +245,7 @@ import { FFContextProvider } from '@harnessio/ff-react-client-sdk'
function MyComponent() {
return (
<FFContextProvider
async={false} // OPTIONAL: whether or not to use async mode
asyncMode={false} // OPTIONAL: whether or not to use async mode
apiKey="YOUR_API_KEY" // your SDK API key
target={{
identifier: 'targetId', // unique ID of the Target
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@harnessio/ff-react-client-sdk",
"version": "1.14.0",
"version": "2.0.0",
"author": "Harness",
"license": "Apache-2.0",
"module": "dist/esm/index.js",
Expand Down
8 changes: 4 additions & 4 deletions src/context/FFContext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('FFContextProvider', () => {
expect(getByText('Loaded')).toBeInTheDocument()
})

test('it triggers onFlagNotFound callback when flag is missing with async disabled', async () => {
test('it triggers onFlagNotFound callback when flag is missing with asyncMode disabled', async () => {
const mockOn = jest.fn()
const mockOnFlagNotFound = jest.fn()

Expand All @@ -86,7 +86,7 @@ describe('FFContextProvider', () => {
apiKey="test-api-key"
target={{ identifier: 'test-target' }}
onFlagNotFound={mockOnFlagNotFound}
async={false}
asyncMode={false}
>
<p>Loaded</p>
</FFContextProvider>
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('FFContextProvider', () => {
)
})

test('it triggers onFlagNotFound callback when flag is missing with async enabled', async () => {
test('it triggers onFlagNotFound callback when flag is missing with asyncMode enabled', async () => {
const mockOn = jest.fn()
const mockOnFlagNotFound = jest.fn()

Expand All @@ -131,7 +131,7 @@ describe('FFContextProvider', () => {
apiKey="test-api-key"
target={{ identifier: 'test-target' }}
onFlagNotFound={mockOnFlagNotFound}
async={true}
asyncMode={true}
>
<p>Loaded</p>
</FFContextProvider>
Expand Down
6 changes: 3 additions & 3 deletions src/context/FFContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface FFContextProviderProps extends PropsWithChildren {
target: Target
options?: Options
fallback?: ReactNode
async?: boolean
asyncMode?: boolean
initialEvaluations?: Evaluation[]
onError?: (event: NetworkError | 'PropsError', error?: unknown) => void
onFlagNotFound?: (
Expand All @@ -53,7 +53,7 @@ export const FFContextProvider: FC<FFContextProviderProps> = ({
target,
options = {},
fallback = <p>Loading...</p>,
async = false,
asyncMode = false,
initialEvaluations,
onError = () => void 0,
onFlagNotFound = () => void 0
Expand Down Expand Up @@ -161,7 +161,7 @@ export const FFContextProvider: FC<FFContextProviderProps> = ({

return (
<FFContext.Provider value={{ loading, flags, client: clientInstance }}>
{!async && loading ? fallback : children}
{!asyncMode && loading ? fallback : children}
</FFContext.Provider>
)
}

0 comments on commit a4d1760

Please sign in to comment.