Only log for discover
This commit is contained in:
@@ -195,9 +195,8 @@ export type MetricEvents = {
|
|||||||
feed: string
|
feed: string
|
||||||
count: number
|
count: number
|
||||||
}
|
}
|
||||||
'feed:emptyError': {
|
|
||||||
feedType: string
|
'feed:discover:emptyError': {
|
||||||
feedId: string
|
|
||||||
userDid: string
|
userDid: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
import {Trans} from '@lingui/macro'
|
import {Trans} from '@lingui/macro'
|
||||||
import {useNavigation} from '@react-navigation/native'
|
import {useNavigation} from '@react-navigation/native'
|
||||||
|
|
||||||
|
import {DISCOVER_FEED_URI} from '#/lib/constants'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {MagnifyingGlassIcon} from '#/lib/icons'
|
import {MagnifyingGlassIcon} from '#/lib/icons'
|
||||||
import {type NavigationProp} from '#/lib/routes/types'
|
import {type NavigationProp} from '#/lib/routes/types'
|
||||||
@@ -21,24 +22,23 @@ import {Text} from '../util/text/Text'
|
|||||||
export function CustomFeedEmptyState() {
|
export function CustomFeedEmptyState() {
|
||||||
const feedFeedback = useFeedFeedbackContext()
|
const feedFeedback = useFeedFeedbackContext()
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
|
const hasLoggedDiscoverEmptyErrorRef = React.useRef(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Log the empty feed error event
|
// Log the empty feed error event
|
||||||
if (feedFeedback.feedSourceInfo && currentAccount?.did) {
|
if (feedFeedback.feedSourceInfo && currentAccount?.did) {
|
||||||
const feedDescriptor = feedFeedback.feedDescriptor
|
const uri = feedFeedback.feedSourceInfo.uri
|
||||||
const [feedType, feedId] = feedDescriptor?.split('|') || [
|
if (
|
||||||
'unknown',
|
uri === DISCOVER_FEED_URI &&
|
||||||
'unknown',
|
!hasLoggedDiscoverEmptyErrorRef.current
|
||||||
]
|
) {
|
||||||
|
hasLoggedDiscoverEmptyErrorRef.current = true
|
||||||
logger.metric('feed:emptyError', {
|
logger.metric('feed:discover:emptyError', {
|
||||||
feedType,
|
userDid: currentAccount.did,
|
||||||
feedId,
|
})
|
||||||
userDid: currentAccount.did,
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
}, [feedFeedback.feedSourceInfo, currentAccount?.did])
|
||||||
}, []) // Only log once when component mounts
|
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const palInverted = usePalette('inverted')
|
const palInverted = usePalette('inverted')
|
||||||
const navigation = useNavigation<NavigationProp>()
|
const navigation = useNavigation<NavigationProp>()
|
||||||
|
|||||||
Reference in New Issue
Block a user