@harnessio/ff-react-client-sdk
Advanced tools
Comparing version
@@ -67,3 +67,8 @@ "use strict"; | ||
client.on(ff_javascript_client_sdk_1.Event.READY, onInitialLoad); | ||
client.on(ff_javascript_client_sdk_1.Event.ERROR_AUTH, onAuthError); | ||
client.on(ff_javascript_client_sdk_1.Event.ERROR_AUTH, (error) => { | ||
// ERROR_AUTH implies that the loading process has stopped | ||
setLoading(false); | ||
loadingRef.current = false; | ||
onAuthError(error); | ||
}); | ||
client.on(ff_javascript_client_sdk_1.Event.ERROR_STREAM, onStreamError); | ||
@@ -96,3 +101,4 @@ client.on(ff_javascript_client_sdk_1.Event.ERROR_FETCH_FLAG, onFetchFlagError); | ||
options === null || options === void 0 ? void 0 : options.streamEnabled, | ||
options === null || options === void 0 ? void 0 : options.pollingEnabled | ||
options === null || options === void 0 ? void 0 : options.pollingEnabled, | ||
options === null || options === void 0 ? void 0 : options.enableAnalytics, | ||
]); | ||
@@ -99,0 +105,0 @@ const value = (0, react_1.useMemo)(() => ({ loading, flags, client: clientInstance }), [loading, flags, clientInstance]); |
@@ -60,3 +60,8 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
client.on(FFEvent.READY, onInitialLoad); | ||
client.on(FFEvent.ERROR_AUTH, onAuthError); | ||
client.on(FFEvent.ERROR_AUTH, (error) => { | ||
// ERROR_AUTH implies that the loading process has stopped | ||
setLoading(false); | ||
loadingRef.current = false; | ||
onAuthError(error); | ||
}); | ||
client.on(FFEvent.ERROR_STREAM, onStreamError); | ||
@@ -89,3 +94,4 @@ client.on(FFEvent.ERROR_FETCH_FLAG, onFetchFlagError); | ||
options === null || options === void 0 ? void 0 : options.streamEnabled, | ||
options === null || options === void 0 ? void 0 : options.pollingEnabled | ||
options === null || options === void 0 ? void 0 : options.pollingEnabled, | ||
options === null || options === void 0 ? void 0 : options.enableAnalytics, | ||
]); | ||
@@ -92,0 +98,0 @@ const value = useMemo(() => ({ loading, flags, client: clientInstance }), [loading, flags, clientInstance]); |
{ | ||
"name": "@harnessio/ff-react-client-sdk", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"author": "Harness", | ||
@@ -24,3 +24,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@harnessio/ff-javascript-client-sdk": "^1.30.0", | ||
"@harnessio/ff-javascript-client-sdk": "^1.31.1", | ||
"lodash.omit": "^4.5.0" | ||
@@ -27,0 +27,0 @@ }, |
@@ -102,3 +102,3 @@ # React.js Client SDK For Harness Feature Flags | ||
By default, the React Client SDK will block rendering of children until the initial load of Feature Flags has completed. | ||
By default, the React Client SDK will block rendering of children until the initial load of Feature Flags has finished, either successfully (`Event.READY` is emitted) or with a non-recoverable error (`Event.ERROR_AUTH` is emitted). | ||
This ensures that children have immediate access to all Flags when they are rendered. However, in some circumstances it | ||
@@ -118,3 +118,3 @@ may be beneficial to immediately render the application and handle display of loading on a component-by-component basis. | ||
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. | ||
3. The `Event.ERROR_AUTH` event is emitted, which means that a non-recoverable error occurred, such as a wrong API key is being used or authentication failed, and the expected flags are not available for that project. | ||
@@ -249,3 +249,3 @@ ```typescript jsx | ||
prop. | ||
The `fallback` component will be displayed while the SDK is connecting and fetching your flags. The `initialEvaluations` | ||
The `fallback` component will be displayed while the SDK is loading 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. | ||
@@ -494,4 +494,4 @@ The `onError` prop allows you to pass an event handler which will be called whenever a network error occurs. | ||
If [Async mode](#Async-mode) is used, the `loading` prop will indicate whether the SDK has completed loading the Flags. | ||
When loading completes, the `loading` prop will be `false` and the `flags` prop will contain all known Flags. | ||
If [Async mode](#Async-mode) is used, the `loading` prop will indicate whether the SDK has finished the initial load of Feature Flags. | ||
When loading finishes, either successfully (`Event.READY` is emitted) or with a non-recoverable error (`Event.ERROR_AUTH` is emitted), the `loading` prop will be `false` and the `flags` prop will contain all known Flags. | ||
@@ -498,0 +498,0 @@ ```typescript jsx |
62567
-17.02%47
-7.84%608
-26.39%