···108108// Our own cache ensures consistent evaluation within a single session.
109109const GateCache = React.createContext<Map<string, boolean> | null>(null)
110110111111-export function useGate(): (gateName: Gate) => boolean {
111111+type GateOptions = {
112112+ dangerouslyDisableExposureLogging?: boolean
113113+}
114114+115115+export function useGate(): (gateName: Gate, options?: GateOptions) => boolean {
112116 const cache = React.useContext(GateCache)
113117 if (!cache) {
114118 throw Error('useGate() cannot be called outside StatsigProvider.')
115119 }
116120 const gate = React.useCallback(
117117- (gateName: Gate): boolean => {
121121+ (gateName: Gate, options: GateOptions = {}): boolean => {
118122 const cachedValue = cache.get(gateName)
119123 if (cachedValue !== undefined) {
120124 return cachedValue
121125 }
122122- const value = Statsig.initializeCalled()
123123- ? Statsig.checkGate(gateName)
124124- : false
126126+ let value = false
127127+ if (Statsig.initializeCalled()) {
128128+ if (options.dangerouslyDisableExposureLogging) {
129129+ value = Statsig.checkGateWithExposureLoggingDisabled(gateName)
130130+ } else {
131131+ value = Statsig.checkGate(gateName)
132132+ }
133133+ }
125134 cache.set(gateName, value)
126135 return value
127136 },
+2-2
src/screens/Onboarding/StepFinished.tsx
···8383 * selected in onboarding and therefore we don't need to run this
8484 * code (which would overwrite the other feeds already set).
8585 */
8686- if (!gate('reduced_onboarding_and_home_algo')) {
8686+ if (!gate('reduced_onboarding_and_home_algo_v2')) {
8787 const otherFeeds = selectedFeeds.length
8888 ? selectedFeeds.map(f => ({
8989 type: 'feed',
···120120 })(),
121121122122 (async () => {
123123- if (!gate('reduced_onboarding_and_home_algo')) return
123123+ if (!gate('reduced_onboarding_and_home_algo_v2')) return
124124125125 const {imageUri, imageMime} = profileStepResults
126126 if (imageUri && imageMime) {
···9494 React.useEffect(() => {
9595 // We have an experiment running for redueced onboarding, where this screen shows up as the first in onboarding.
9696 // We only want to request permissions when that gate is actually active to prevent pollution
9797- if (gate('reduced_onboarding_and_home_algo')) {
9797+ if (gate('reduced_onboarding_and_home_algo_v2')) {
9898 requestNotificationsPermission('StartOnboarding')
9999 }
100100 }, [gate, requestNotificationsPermission])
···152152 feedTuners,
153153 userInterests, // Not in the query key because they don't change.
154154 getAgent,
155155- useBaseFollowingFeed: gate('reduced_onboarding_and_home_algo'),
155155+ useBaseFollowingFeed: gate(
156156+ 'reduced_onboarding_and_home_algo_v2',
157157+ {
158158+ // If you're not already in this experiment, we don't want to expose you to it now.
159159+ dangerouslyDisableExposureLogging: true,
160160+ },
161161+ ),
156162 }),
157163 cursor: undefined,
158164 }
+2-2
src/view/com/testing/TestCtrls.e2e.tsx
···112112 testID="e2eStartOnboarding"
113113 onPress={() => {
114114 // TODO remove when experiment is over
115115- setGate('reduced_onboarding_and_home_algo', true)
115115+ setGate('reduced_onboarding_and_home_algo_v2', true)
116116 onboardingDispatch({type: 'start'})
117117 }}
118118 accessibilityRole="button"
···123123 testID="e2eStartLongboarding"
124124 onPress={() => {
125125 // TODO remove when experiment is over
126126- setGate('reduced_onboarding_and_home_algo', false)
126126+ setGate('reduced_onboarding_and_home_algo_v2', false)
127127 onboardingDispatch({type: 'start'})
128128 }}
129129 accessibilityRole="button"