Date of slack thread: 6/17/24
Anonymous: Hello! I’m hoping for some guidance on how to avoid initial user sessions having no values. From here:
In practice (Unless an additional update call is made), this means that for the very first session of a given user, there will be no values, and not until the next session will the cache have values.
If we want initial sessions to have values, is there a workaround we can use (like prefetching users?) or do we need to move to bootstrapping values?
tore (Statsig): If you want everyone to have up-to-date values on every session, you should use the asynchronous initialization, not the synchronous initialization.
tore (Statsig): (Prefetch + cache = complicated way of doing async initialization)
Anonymous: Gotcha, ok! So if we have a SPA that grabs the current user from graphql, we could read in that user and call await myStatsigClient.updateUserAsync(user);
and in theory we should be good to go?
tore (Statsig): Bootstrapping is always suggested as the very best integration - most up-to-date values, no async network request to fetch them. But it is more complicated to set up.
tore (Statsig): Yup, as long as you call the initializeAsync
and updateUserAsync
methods and wait for them, you’ll get the most up-to-date values (provided the network request is successful).
Anonymous: Gotcha, thank you!