In the event of encountering unexpected diagnostic results when evaluating a gate on React Native, despite the gate being set to 100% pass and Statsig being initialized, there are several potential causes to consider.
The "Uninitialized" status in evaluationDetails.reason
can occur even after calling .initialize()
and awaiting the result. This issue can be due to several reasons:
1. **Ad Blockers**: Ad blockers can interfere with the initialization network request, causing it to fail.
2. **Network Failures**: Any network issues that prevent the initialization network request from completing successfully can result in an "Uninitialized" status.
3. **Timeouts**: The statsig-js SDK applies a default 3-second timeout on the initialize request. This can lead to more frequent initialization timeouts on mobile clients where users may have slower connections.
If you encounter this issue, it's recommended to investigate the potential causes listed above. Check for the presence of ad blockers, network issues, and timeouts. This will help you identify the root cause and implement the appropriate solution.
If you're still experiencing issues, you can check the diagnostics tab for higher-level pass/fail/bucketing population sizes over time. For debugging specific checks, the logstream at the bottom is useful and shows both production and non-production exposures in near real-time. You can also use the Users tab to see historical evaluation results for a given ID.
One potential solution to this issue is to use the waitForInitialization
option. When you don’t use this option, any of your components will be called immediately, regardless of if Statsig has initialized. This can result in 'Uninitialized' exposures. By setting waitForInitialization=true
, you can defer the rendering of those components until after statsig has already initialized. This will guarantee the components aren’t called until initialize has completed, and you won’t see any of those ‘Uninitialized’ exposures being logged. You can find more details in the SDK documentation.
You can also verify the initialization by checking the value of isLoading
from useGate
and useConfig
and also initialized
and initStarted
from StatsigContext
. If the issue persists, please reach out to the Statsig team for further assistance.