Skip to content

Fallback Support for JavaScript #717

@exhuma

Description

@exhuma

Describe the feature request

Add support for "fallback" values to the JS API

Background

The documentation of the Python SDK mentions fallback values. This support is not present in the current JS SDK

Currently the isEnabled method cannot return a stable default value as recommended in your best practices. Some features may make sense to be "enabled by default" while others may need to be "disabled by default".

If the state cannot be retrieved for any reason, the current JS-SDK only ever returns false.

In a worst-case scenario this would leave application devoid of much functionality whenever unleash is unreachable or when features are not found for whatever reason.

Solution suggestions

Provide the same solution as provided in the Python SDK.

For example:

const client = new UnleashClient(...);
client.isEnabled('my-feature', () => true);

Alternatively, a static value would work too but this would break consistency with the Python SDK:

const client = new UnleashClient(...);
client.isEnabled('my-feature', true);

Metadata

Metadata

Assignees

Type

No type

Projects

Status

For later

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions