I am using the Statsig React sdk to check a gate an show some UI if the gate returns true. When I initialize with a user id that passes the gate, everything works as I would expect and the UI is rendered.
The issue I am having is that I cannot get the UI to change when I call Statsig.updateUser. Is this a bug or am I doing something wrong?
I have a test gate setup to pass for a specific user id ("user-that-passes").
Here is the most basic setup I can get to reproduce this issue.
function Test() {
return (
<>
<button
onClick={() => Statsig.updateUser({ userID: "user-that-passes" })}
>
Update
</button>
<p>{Statsig.checkGate("test_gate") ? "Pass" : "Fail"}</p>
</>
);
}
function App() {
return (
<StatsigProvider
sdkKey="intentionally blank"
user={{ userID: "user-that-fails" }}
waitForInitialization={true}
>
<Test />
</StatsigProvider>
);
}
If I click the button that calls Statsig.updateUser, nothing happens and the gate still fails.
Is anyone able to help me here?
Thank you