Add logging of selected feed preference when displaying the following feed (#4789)

zio/stable
Hailey 2024-08-07 17:13:29 -07:00 committed by GitHub
parent 1b02f81cb8
commit b3092413dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 2 deletions

View File

@ -211,6 +211,12 @@ export type LogEvents = {
'feed:interstitial:profileCard:press': {} 'feed:interstitial:profileCard:press': {}
'feed:interstitial:feedCard:press': {} 'feed:interstitial:feedCard:press': {}
'debug:followingPrefs': {
followingShowRepliesFromPref: 'all' | 'following' | 'off'
followingRepliesMinLikePref: number
}
'debug:followingDisplayed': {}
'test:all:always': {} 'test:all:always': {}
'test:all:sometimes': {} 'test:all:sometimes': {}
'test:all:boosted_by_gate1': {reason: 'base' | 'gate1'} 'test:all:boosted_by_gate1': {reason: 'base' | 'gate1'}

View File

@ -9,7 +9,7 @@ import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
import {logEvent, LogEvents} from '#/lib/statsig/statsig' import {logEvent, LogEvents} from '#/lib/statsig/statsig'
import {emitSoftReset} from '#/state/events' import {emitSoftReset} from '#/state/events'
import {SavedFeedSourceInfo, usePinnedFeedsInfos} from '#/state/queries/feed' import {SavedFeedSourceInfo, usePinnedFeedsInfos} from '#/state/queries/feed'
import {FeedParams} from '#/state/queries/post-feed' import {FeedDescriptor, FeedParams} from '#/state/queries/post-feed'
import {usePreferencesQuery} from '#/state/queries/preferences' import {usePreferencesQuery} from '#/state/queries/preferences'
import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types' import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types'
import {useSession} from '#/state/session' import {useSession} from '#/state/session'
@ -108,6 +108,30 @@ function HomeScreenReady({
} }
}, [selectedIndex]) }, [selectedIndex])
// Temporary, remove when finished debugging
const debugHasLoggedFollowingPrefs = React.useRef(false)
const debugLogFollowingPrefs = React.useCallback(
(feed: FeedDescriptor) => {
if (debugHasLoggedFollowingPrefs.current) return
if (feed !== 'following') return
logEvent('debug:followingPrefs', {
followingShowRepliesFromPref: preferences.feedViewPrefs.hideReplies
? 'off'
: preferences.feedViewPrefs.hideRepliesByUnfollowed
? 'following'
: 'all',
followingRepliesMinLikePref:
preferences.feedViewPrefs.hideRepliesByLikeCount,
})
debugHasLoggedFollowingPrefs.current = true
},
[
preferences.feedViewPrefs.hideReplies,
preferences.feedViewPrefs.hideRepliesByLikeCount,
preferences.feedViewPrefs.hideRepliesByUnfollowed,
],
)
const {hasSession} = useSession() const {hasSession} = useSession()
const setMinimalShellMode = useSetMinimalShellMode() const setMinimalShellMode = useSetMinimalShellMode()
const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled() const setDrawerSwipeDisabled = useSetDrawerSwipeDisabled()
@ -136,6 +160,7 @@ function HomeScreenReady({
feedUrl: selectedFeed, feedUrl: selectedFeed,
reason: 'focus', reason: 'focus',
}) })
debugLogFollowingPrefs(selectedFeed)
} }
}), }),
) )
@ -182,8 +207,9 @@ function HomeScreenReady({
feedUrl: feed, feedUrl: feed,
reason, reason,
}) })
debugLogFollowingPrefs(feed)
}, },
[allFeeds], [allFeeds, debugLogFollowingPrefs],
) )
const onPressSelected = React.useCallback(() => { const onPressSelected = React.useCallback(() => {