Date of slack thread: 5/9/24
Anonymous: I am using:
waitForInitialization
=false
useExperiment
hookenabled
=true
for 100% of usersMy component has code like this:
const enabled = config.get('enabled', false)```
My assumption was that once `isLoading` becomes `false` (done loading) that `enabled` would immediately and always be `true`.
However I frequently see that when `isLoading` becomes `false` `enabled` can be `false` for a few renders until it turns `true`.
Is this a bug or am I misunderstanding the return values of `useExperiment`?
Thanks!
**Anonymous:** To put it another way I get the wrong value a few times but after a few renders I get the correct value. This is problematic in my current experiment because my experiment involved whether we should redirect the user to another page. So if the first value is wrong I do the wrong thing (redirect the user when I shouldn’t have) and I can’t correct it. Thanks.
**Vijaye (Statsig):** We don’t automatically update the config object. You will need to refetch the values after init. If you making redirect decision you would want to do this synchronously, right? Maybe if you explain the scenario in detail we could suggest ways of doing this cleanly.
**Anonymous:** When page `/feature` loads redirect them to page `/not-available` unless feature is enabled for this user.
Is it possible to know when the config is fully and the `enabled` value is safe to be used / correct?