about summary refs log tree commit diff
path: root/src/lib/statsig
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-12-13 17:14:41 +0000
committerGitHub <noreply@github.com>2024-12-13 17:14:41 +0000
commite2a7965e438db9f70d76d2d7a911aa4c4a42c122 (patch)
treed75b04cf03ad3300feb221341580cca36a9c7005 /src/lib/statsig
parent5655241bef22264ad9da3d9ba2074af4e9ba7dd0 (diff)
downloadvoidsky-e2a7965e438db9f70d76d2d7a911aa4c4a42c122.tar.zst
Gate bitdrift integration (#7088)
* Move Statsig init call earlier

* Gate Bitdrift init call

* Remove IS_TEST env constant

* Mock statsig
Diffstat (limited to 'src/lib/statsig')
-rw-r--r--src/lib/statsig/statsig.tsx5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx
index 51d7eb98e..21fa4bb57 100644
--- a/src/lib/statsig/statsig.tsx
+++ b/src/lib/statsig/statsig.tsx
@@ -16,6 +16,8 @@ import {Gate} from './gates'
 
 const SDK_KEY = 'client-SXJakO39w9vIhl3D44u8UupyzFl4oZ2qPIkjwcvuPsV'
 
+export const initPromise = initialize()
+
 type StatsigUser = {
   userID: string | undefined
   // TODO: Remove when enough users have custom.platform:
@@ -219,9 +221,6 @@ export async function tryFetchGates(
       // Use this for less common operations where the user would be OK with a delay.
       timeoutMs = 1500
     }
-    // Note: This condition is currently false the very first render because
-    // Statsig has not initialized yet. In the future, we can fix this by
-    // doing the initialization ourselves instead of relying on the provider.
     if (Statsig.initializeCalled()) {
       await Promise.race([
         timeout(timeoutMs),