Flagsmith Js Client Versions Save

Javascript Client for Flagsmith. Ship features with confidence using feature flags and remote config. Host yourself or use our hosted version at https://www.flagsmith.com/

4.0.0

1 month ago

This will be the first version compatible with OpenFeature. Merges https://github.com/Flagsmith/flagsmith-js-client/pull/223

Breaking changes

  • Init will now reject if:
    • No environment ID is provider
    • Fetch fails and there's no cache (Init resolves on cache)
    • There's no cache/defaults and preventFetch is true
  • The boolean properties traitsChange and flagsChanged are now a string[] of changed keys or null. This reduces breaking changes since falsey and truthy checks will still behave as before.

Other changes

  • Init is (finally) async/await
  • Init code is reduced by pulling out isolated functions
  • Added tests around init promises
  • Organised util files

3.24.0

1 month ago

Closes https://github.com/Flagsmith/flagsmith-js-client/pull/222

The SDK will now synchronously read cache rather than fetching it asynchronously.

3.23.0

2 months ago

Closes https://github.com/Flagsmith/flagsmith-js-client/issues/214

  • Fixes flag updates from useFlags
  • Fixes flag updates where flagsmith.init is not called

3.22.1

2 months ago

3.22.0

4 months ago

Prior to this release, clients that request identified/unidentified flags simultaneously could see the wrong results due to a race condition. Although this signifies incorrect usage of the SDK, this will no longer occur.

For more information see https://github.com/Flagsmith/flagsmith-js-client/pull/205.

3.19.0

10 months ago

This introduces a strategy to responding to loading state changes in flagsmith

The following will be exposed to Flagsmith:

export declare enum FlagSource {
    "NONE" = "NONE",
    "DEFAULT_FLAGS" = "DEFAULT_FLAGS",
    "CACHE" = "CACHE",
    "SERVER" = "SERVER",
}

export declare type LoadingState = {
    error: Error | null, // Current error, resets on next attempt to fetch flags
    isFetching: bool, // Whether there is a current request to fetch server flags
    isLoading: bool,  // Whether any flag data exists
    source: FlagSource //Indicates freshness of flags
}

It can be consumed via the onChange function of flagsmith.init or the newly introduced useFlagsmithLoading

    onChange?: (previousFlags: IFlags<F> | null, params: IRetrieveInfo, loadingState:LoadingState) => void;
    const loadingState:LoadingState = useFlagsmithLoading()

3.18.4

10 months ago

This version includes an npm audit fix.