Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@harnessio/ff-react-client-sdk

Package Overview
Dependencies
Maintainers
0
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harnessio/ff-react-client-sdk - npm Package Compare versions

Comparing version 2.0.0-rc.1 to 2.0.0

2

dist/cjs/context/FFContext.d.ts
import { FC, PropsWithChildren, ReactNode } from 'react';
import { DefaultVariationEventPayload, Evaluation, Event as FFEvent, Options, Result as InitializeResult, Target } from '@harnessio/ff-javascript-client-sdk';
import { Evaluation, Event as FFEvent, Options, Result as InitializeResult, Target, DefaultVariationEventPayload } from '@harnessio/ff-javascript-client-sdk';
export interface FFContextValue {

@@ -4,0 +4,0 @@ loading: boolean;

@@ -48,3 +48,3 @@ "use strict";

});
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 () => {
var _a, _b;

@@ -71,3 +71,3 @@ const mockOn = jest.fn();

});
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 () => {
var _a, _b;

@@ -74,0 +74,0 @@ const mockOn = jest.fn();

import { FC, PropsWithChildren, ReactNode } from 'react';
import { DefaultVariationEventPayload, Evaluation, Event as FFEvent, Options, Result as InitializeResult, Target } from '@harnessio/ff-javascript-client-sdk';
import { Evaluation, Event as FFEvent, Options, Result as InitializeResult, Target, DefaultVariationEventPayload } from '@harnessio/ff-javascript-client-sdk';
export interface FFContextValue {

@@ -4,0 +4,0 @@ loading: boolean;

@@ -46,3 +46,3 @@ import { jsx as _jsx } from "react/jsx-runtime";

});
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 () => {
var _a, _b;

@@ -69,3 +69,3 @@ const mockOn = jest.fn();

});
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 () => {
var _a, _b;

@@ -72,0 +72,0 @@ const mockOn = jest.fn();

{
"name": "@harnessio/ff-react-client-sdk",
"version": "2.0.0-rc.1",
"version": "2.0.0",
"author": "Harness",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -108,10 +108,10 @@ # React.js Client SDK For Harness Feature Flags

## On Flag Not Found
The `onFlagNotFound` option allows you to handle situations where a default variation is returned.
It includes the flag, variation, and whether the SDK was still initializing (`loading)` when the default was served.
The `onFlagNotFound` option allows you to handle situations where a default variation is returned.
It includes the flag, variation, and whether the SDK was still initializing (`loading)` when the default was served.
This can happen when:
1. Using `asyncMode` 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).

@@ -129,9 +129,5 @@ 3. The wrong API key is being used, and the expected flags are not available for that project.

if (loading) {
console.debug(
`Flag "${flagNotFound.flag}" not found because the SDK is still initializing. Returned default: ${flagNotFound.defaultVariation}`
)
console.debug(`Flag "${flagNotFound.flag}" not found because the SDK is still initializing. Returned default: ${flagNotFound.defaultVariation}`);
} else {
console.warn(
`Flag "${flagNotFound.flag}" not found. Returned default: ${flagNotFound.defaultVariation}`
)
console.warn(`Flag "${flagNotFound.flag}" not found. Returned default: ${flagNotFound.defaultVariation}`);
}

@@ -142,6 +138,6 @@ }}

</FFContextProvider>
```
By using the `onFlagNotFound` prop, your application can be notified whenever a flag is missing and the default
variation has been returned.
By using the `onFlagNotFound` prop, your application can be notified whenever a flag is missing and the default variation has been returned.

@@ -242,4 +238,3 @@ ## Caching evaluations

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 `asyncMode`
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`

@@ -246,0 +241,0 @@ prop allows you pass an array of evaluations to use immediately as the SDK is authenticating and fetching flags.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc