Skip to main content

Migrating From statsig-js

The architecture and majority of the APIs in the updated SDK have been retained; however, modifications have been made to address common pitfalls, resolve existing issues, and streamline the SDK logic.

Below is a list of identified breaking changes that will require manual refactoring:

Initialization

Previously, the SDK employed a single method for initialization. However, we have recognized that waiting for a method call during app startup can be impractical. Consequently, we have introduced two distinct initialization approaches: one synchronous and one asynchronous.

Synchronous initialization will leverage cache (if available), returning immediately. Data for subsequent sessions will then be fetched in the background.

Asynchronous initialization, on the other hand, is awaitable and ensures that the most current data is fetched and used.

...

You can read more about StatsigClient initialization here.

Updating the User

Similar to initialization, the updateUser method now supports both synchronous and asynchronous approaches. Each method functions in the same manner as the initialization process.

...

Static Instance

In the previous SDK version, there was a top-level static interface for using Statsig. To enhance support for multiple instances, we have replaced this with a static method that retrieves an instance.

...

You can read more about StatsigClient multi-instance support here.

GDPR

In certain use cases, it is necessary to suspend cache and network usage until the user grants specific permissions. Previously, the method for achieving this was somewhat fragmented. In the new SDK, these functionalities have been consolidated for improved coherence and ease of implementation.

...