Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Statsig] Fix exposure logging for reduced onboarding (#4131)

* Add dangerouslyDisableExposureLogging option

* Rename onboarding gate to v2

* Disable exposure logging for onboarding in PostFeed query

authored by

dan and committed by
GitHub
4fa92d7a 516eb696

+29 -14
+1 -1
src/lib/statsig/gates.ts
··· 4 4 | 'disable_min_shell_on_foregrounding_v3' 5 5 | 'disable_poll_on_discover_v2' 6 6 | 'dms' 7 - | 'reduced_onboarding_and_home_algo' 7 + | 'reduced_onboarding_and_home_algo_v2' 8 8 | 'request_notifications_permission_after_onboarding' 9 9 | 'show_follow_back_label_v2' 10 10 | 'start_session_with_following_v2'
+14 -5
src/lib/statsig/statsig.tsx
··· 108 108 // Our own cache ensures consistent evaluation within a single session. 109 109 const GateCache = React.createContext<Map<string, boolean> | null>(null) 110 110 111 - export function useGate(): (gateName: Gate) => boolean { 111 + type GateOptions = { 112 + dangerouslyDisableExposureLogging?: boolean 113 + } 114 + 115 + export function useGate(): (gateName: Gate, options?: GateOptions) => boolean { 112 116 const cache = React.useContext(GateCache) 113 117 if (!cache) { 114 118 throw Error('useGate() cannot be called outside StatsigProvider.') 115 119 } 116 120 const gate = React.useCallback( 117 - (gateName: Gate): boolean => { 121 + (gateName: Gate, options: GateOptions = {}): boolean => { 118 122 const cachedValue = cache.get(gateName) 119 123 if (cachedValue !== undefined) { 120 124 return cachedValue 121 125 } 122 - const value = Statsig.initializeCalled() 123 - ? Statsig.checkGate(gateName) 124 - : false 126 + let value = false 127 + if (Statsig.initializeCalled()) { 128 + if (options.dangerouslyDisableExposureLogging) { 129 + value = Statsig.checkGateWithExposureLoggingDisabled(gateName) 130 + } else { 131 + value = Statsig.checkGate(gateName) 132 + } 133 + } 125 134 cache.set(gateName, value) 126 135 return value 127 136 },
+2 -2
src/screens/Onboarding/StepFinished.tsx
··· 83 83 * selected in onboarding and therefore we don't need to run this 84 84 * code (which would overwrite the other feeds already set). 85 85 */ 86 - if (!gate('reduced_onboarding_and_home_algo')) { 86 + if (!gate('reduced_onboarding_and_home_algo_v2')) { 87 87 const otherFeeds = selectedFeeds.length 88 88 ? selectedFeeds.map(f => ({ 89 89 type: 'feed', ··· 120 120 })(), 121 121 122 122 (async () => { 123 - if (!gate('reduced_onboarding_and_home_algo')) return 123 + if (!gate('reduced_onboarding_and_home_algo_v2')) return 124 124 125 125 const {imageUri, imageMime} = profileStepResults 126 126 if (imageUri && imageMime) {
+1 -1
src/screens/Onboarding/StepInterests/index.tsx
··· 134 134 }, [track]) 135 135 136 136 React.useEffect(() => { 137 - if (!gate('reduced_onboarding_and_home_algo')) { 137 + if (!gate('reduced_onboarding_and_home_algo_v2')) { 138 138 requestNotificationsPermission('StartOnboarding') 139 139 } 140 140 }, [gate, requestNotificationsPermission])
+1 -1
src/screens/Onboarding/StepProfile/index.tsx
··· 94 94 React.useEffect(() => { 95 95 // We have an experiment running for redueced onboarding, where this screen shows up as the first in onboarding. 96 96 // We only want to request permissions when that gate is actually active to prevent pollution 97 - if (gate('reduced_onboarding_and_home_algo')) { 97 + if (gate('reduced_onboarding_and_home_algo_v2')) { 98 98 requestNotificationsPermission('StartOnboarding') 99 99 } 100 100 }, [gate, requestNotificationsPermission])
+1 -1
src/screens/Onboarding/index.tsx
··· 24 24 export function Onboarding() { 25 25 const {_} = useLingui() 26 26 const gate = useGate() 27 - const isReducedOnboardingEnabled = gate('reduced_onboarding_and_home_algo') 27 + const isReducedOnboardingEnabled = gate('reduced_onboarding_and_home_algo_v2') 28 28 const [state, dispatch] = React.useReducer( 29 29 isReducedOnboardingEnabled ? reducerReduced : reducer, 30 30 isReducedOnboardingEnabled ? {...initialStateReduced} : {...initialState},
+7 -1
src/state/queries/post-feed.ts
··· 152 152 feedTuners, 153 153 userInterests, // Not in the query key because they don't change. 154 154 getAgent, 155 - useBaseFollowingFeed: gate('reduced_onboarding_and_home_algo'), 155 + useBaseFollowingFeed: gate( 156 + 'reduced_onboarding_and_home_algo_v2', 157 + { 158 + // If you're not already in this experiment, we don't want to expose you to it now. 159 + dangerouslyDisableExposureLogging: true, 160 + }, 161 + ), 156 162 }), 157 163 cursor: undefined, 158 164 }
+2 -2
src/view/com/testing/TestCtrls.e2e.tsx
··· 112 112 testID="e2eStartOnboarding" 113 113 onPress={() => { 114 114 // TODO remove when experiment is over 115 - setGate('reduced_onboarding_and_home_algo', true) 115 + setGate('reduced_onboarding_and_home_algo_v2', true) 116 116 onboardingDispatch({type: 'start'}) 117 117 }} 118 118 accessibilityRole="button" ··· 123 123 testID="e2eStartLongboarding" 124 124 onPress={() => { 125 125 // TODO remove when experiment is over 126 - setGate('reduced_onboarding_and_home_algo', false) 126 + setGate('reduced_onboarding_and_home_algo_v2', false) 127 127 onboardingDispatch({type: 'start'}) 128 128 }} 129 129 accessibilityRole="button"