Bluesky app fork with some witchin' additions 💫

Adds client event for empty feed error (#9287)

* Adds client event for empty feed error

* Only log for discover

---------

Co-authored-by: Eric Bailey <git@esb.lol>

authored by

Alex Benzer
Eric Bailey
and committed by
GitHub
5a4e012f 6ccedd5e

+28 -1
+4
src/logger/metrics.ts
··· 196 196 count: number 197 197 } 198 198 199 + 'feed:discover:emptyError': { 200 + userDid: string 201 + } 202 + 199 203 'composer:gif:open': {} 200 204 'composer:gif:select': {} 201 205
+24 -1
src/view/com/posts/CustomFeedEmptyState.tsx
··· 1 - import React from 'react' 1 + import React, {useEffect} from 'react' 2 2 import {StyleSheet, View} from 'react-native' 3 3 import { 4 4 FontAwesomeIcon, ··· 7 7 import {Trans} from '@lingui/macro' 8 8 import {useNavigation} from '@react-navigation/native' 9 9 10 + import {DISCOVER_FEED_URI} from '#/lib/constants' 10 11 import {usePalette} from '#/lib/hooks/usePalette' 11 12 import {MagnifyingGlassIcon} from '#/lib/icons' 12 13 import {type NavigationProp} from '#/lib/routes/types' 13 14 import {s} from '#/lib/styles' 15 + import {logger} from '#/logger' 14 16 import {isWeb} from '#/platform/detection' 17 + import {useFeedFeedbackContext} from '#/state/feed-feedback' 18 + import {useSession} from '#/state/session' 15 19 import {Button} from '../util/forms/Button' 16 20 import {Text} from '../util/text/Text' 17 21 18 22 export function CustomFeedEmptyState() { 23 + const feedFeedback = useFeedFeedbackContext() 24 + const {currentAccount} = useSession() 25 + const hasLoggedDiscoverEmptyErrorRef = React.useRef(false) 26 + 27 + useEffect(() => { 28 + // Log the empty feed error event 29 + if (feedFeedback.feedSourceInfo && currentAccount?.did) { 30 + const uri = feedFeedback.feedSourceInfo.uri 31 + if ( 32 + uri === DISCOVER_FEED_URI && 33 + !hasLoggedDiscoverEmptyErrorRef.current 34 + ) { 35 + hasLoggedDiscoverEmptyErrorRef.current = true 36 + logger.metric('feed:discover:emptyError', { 37 + userDid: currentAccount.did, 38 + }) 39 + } 40 + } 41 + }, [feedFeedback.feedSourceInfo, currentAccount?.did]) 19 42 const pal = usePalette('default') 20 43 const palInverted = usePalette('inverted') 21 44 const navigation = useNavigation<NavigationProp>()