Releases: Flagsmith/flagsmith-js-client
3.22.0 - Prevent race condition between identify/getFlags
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 #205.
3.19.0 - Access Flagsmith loading state
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 - Audit fix
This version includes an npm audit fix.
3.18.3 - Ignore undefined traits
3.18.2 - Adds Datadog RUM
This release adds an integration to Datadog RUM, it focuses on the new experimental feature_flags feature, you can read more about it here https://docs.datadoghq.com/real_user_monitoring/guide/setup-feature-flag-data-collection/?tab=npm.
This will track remote config and feature enabled states as feature flags in the following format
flagsmith_value_<FEATURE_NAME> // remote config
flagsmith_enabled_<FEATURE_NAME> // enabled state
Additionally, the integration will also store Flagsmith traits against the Datadog user in the following format:
flagsmith_trait_<FEATURE_NAME> // remote config
You can find an example of this integration here.
3.18.1 - Realtime features
This release adds a stable implementation of realtime features and is used on app.flagsmith.com.
Flagsmith projects that are opted into realtime are able to enable realtime within flagsmith.init as {realtime: true}, this will instruct the SDK to connect to our realtime SSE endpoint to receive feature updates from the environment and segment overrides.
3.16.0 - Always send an Error object to onError
Closes #93. This aims to make the type of onError more predictable by always sending it as an Error object. Thank you to @gfrancischini for the sensible suggestion!
3.15.1 - Fix Promise return from setTrait(s)
Prior to this release, setTrait(s) calls were not returning a promise, they will now resolve when the API returns a new set of flags.
3.15.0 - Unify and improve setTrait / setTraits calls
- Calls to setTrait/setTraits now only hit 1 endpoint, previously they hit 2.
- The behaviour of setTrait now matches setTraits, prior to this you could not delete a trait via
flagsmith.setTrait("trait",null). Also, this prevents an issue where segment flags were sometimes not returned in response to setting a trait.
3.14.1 - React fix: initialise flagsmith with serverState if provided
Prior to this release, there were cases where flags provided by serverState are cleared, potentially effecting the isomorphic client (e.g. Next.js applications). This is because <ReactProvider/> initialises Flagsmith internally after server state is set.
This change makes sure that Flagsmith is initialises with the server state so that the state is preserved.