Releases: statsig-io/react-sdk
v1.2.0 - upgrade internal Javascript SDK
With this release we upgraded the version of the internal Statsig javascript SDK, which brings 2 changes:
v1.1.0 - Adds localMode option
Adds a statsig option called localMode
LocalMode short circuits all network requests. As a result, all gate/config/experiment checks will return default values. They can be overridden.
Useful for tests or local debugging to force values to a known state.
v1.0.2 [Internal] upgrade internal js sdk dependency
upgrade internal js sdk dependency for log beacon endpoint
v1.0.1 - Updating statsig-react with v4+ of the statsig-js SDK
Migrates the statsig-react
sdk to v4.0 of the statsig-js
SDK. This introduces a number of breaking changes and enhancements.
Breaking Changes:
- Removed the
useStatsig
hook. Instead, useimport Statsig from 'statsig-react'
to use thestatsig-js
sdk for event logging, or gate checks/event logging outside of a component tree. NOTE: SDK methods likecheckGate
andlogEvent
will throw if called beforeinitialize()
- to avoid errors in your component tree, checkinitStarted
from theStatsigContext
, or globally, checkStatsig.initializedCalled()
- Removed the separate
DynamicConfig
type, instead directly exporting the same type from thestatsig-js
sdk.
Enhancements and Bug Fixes:
- Unify the type of
DynamicConfig
to be a single type across this SDK and thestatsig-js
sdk. - Memoizes the result of gate/config checks for a given user for enhanced performance and to reduce duplicate exposures.
- Adds
initializationComponent
to render while initializing ifwaitForInitialization
istrue
- Fetches cached flag values from local storage while initialize is pending if
waitForInitialization
isfalse
. This means the first render pass will be waiting for initialization, the second will be with cached values, waiting for the initialize response from the server, and the third will have the up to date values from the server - Fixes an issue where changing the user object could trigger an
updateUser
while the SDK was initializing, which would throw an exception
Additional features (inherited from statsig-js
). See the releases for more details:
DynamicConfig
overrides- Ability to
checkGate
andgetConfig
without overrides, which is also added on theuseGate
,useConfig
, anduseExperiment
hooks - Improved support for browsers + event logging, SSR logging bug fix, and configurations for event batch sizes and event flush intervals.
- Added support for
customIDs
on theStatsigUser
object
NOTE:
If you are calling methods on the global Statsig
like initialize
or updateUser
, the user object tracked by the provider and the user object used outside the component tree can get out of sync. You are responsible for maintaining the state of the user
and keeping it consistent with the StatsigProvider
in these cases. The statsig-react
SDK uses the global Statsig
class to serve gate/config/experiment checks, but these are memoized in the hooks the SDK provides. Updates to the user which impact flag values that are made outside the context of the react component tree will not be reflected in the component tree unless the updated user is passed in to the StatsigProvider
.
v1.0.0 - Updating statsig-react with v4+ of the statsig-js SDK
Migrates the statsig-react
sdk to v4.0 of the statsig-js
SDK. This introduces a number of breaking changes and enhancements.
Breaking Changes:
- Removed the
useStatsig
hook. Instead, useimport Statsig from 'statsig-react'
to use thestatsig-js
sdk for event logging, or gate checks/event logging outside of a component tree. NOTE: SDK methods likecheckGate
andlogEvent
will throw if called beforeinitialize()
- to avoid errors in your component tree, checkinitStarted
from theStatsigContext
, or globally, checkStatsig.initializedCalled()
- Removed the separate
DynamicConfig
type, instead directly exporting the same type from thestatsig-js
sdk.
Enhancements and Bug Fixes:
- Unify the type of
DynamicConfig
to be a single type across this SDK and thestatsig-js
sdk. - Memoizes the result of gate/config checks for a given user for enhanced performance and to reduce duplicate exposures.
- Adds
initializationComponent
to render while initializing ifwaitForInitialization
istrue
- Fetches cached flag values from local storage while initialize is pending if
waitForInitialization
isfalse
. This means the first render pass will be waiting for initialization, the second will be with cached values, waiting for the initialize response from the server, and the third will have the up to date values from the server - Fixes an issue where changing the user object could trigger an
updateUser
while the SDK was initializing, which would throw an exception
Additional features (inherited from statsig-js
). See the releases for more details:
DynamicConfig
overrides- Ability to
checkGate
andgetConfig
without overrides - Improved support for browsers + event logging, SSR logging bug fix, and configurations for event batch sizes and event flush intervals.
NOTE:
If you are calling methods on the global Statsig
like initialize
or updateUser
, the user object tracked by the provider and the user object used outside the component tree can get out of sync. You are responsible for maintaining the state of the user
and keeping it consistent with the StatsigProvider
in these cases. The statsig-react
SDK uses the global Statsig
class to serve gate/config/experiment checks, but these are memoized in the hooks the SDK provides. Updates to the user which impact flag values that are made outside the context of the react component tree will not be reflected in the component tree unless the updated user is passed in to the StatsigProvider
.
v0.5.7 - Add missing exports for StatsigUser, StatsigOptions, and StatsigEnvironment
v0.5.7 add missing types
v0.5.6 - Export hook types from index file for easy import
Minor patch to export some types returned by the hook calls from the main index.ts
Fixed a rare bug when Statsig unmounts and remounts
Fixed a rare bug when Statsig unmounts and remounts, which would cause it to not fetch new values if user changes.
New patch version with a bug fix
Fixed a bug where values for updated user is not fetched again from Statsig server when the user object is changed.