parent
7eaa573b57
commit
1c25c76645
|
@ -2,6 +2,18 @@ export type LogEvents = {
|
||||||
init: {
|
init: {
|
||||||
initMs: number
|
initMs: number
|
||||||
}
|
}
|
||||||
|
'feed:endReached': {
|
||||||
|
feedType: string
|
||||||
|
itemCount: number
|
||||||
|
}
|
||||||
|
'post:create': {
|
||||||
|
imageCount: number
|
||||||
|
isReply: boolean
|
||||||
|
hasLink: boolean
|
||||||
|
hasQuote: boolean
|
||||||
|
langs: string
|
||||||
|
logContext: 'Composer'
|
||||||
|
}
|
||||||
'post:like': {
|
'post:like': {
|
||||||
logContext: 'FeedItem' | 'PostThreadItem' | 'Post'
|
logContext: 'FeedItem' | 'PostThreadItem' | 'Post'
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ import {logger} from '#/logger'
|
||||||
import {ComposerReplyTo} from 'view/com/composer/ComposerReplyTo'
|
import {ComposerReplyTo} from 'view/com/composer/ComposerReplyTo'
|
||||||
import * as Prompt from '#/components/Prompt'
|
import * as Prompt from '#/components/Prompt'
|
||||||
import {useDialogStateControlContext} from 'state/dialogs'
|
import {useDialogStateControlContext} from 'state/dialogs'
|
||||||
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
|
|
||||||
type Props = ComposerOpts
|
type Props = ComposerOpts
|
||||||
export const ComposePost = observer(function ComposePost({
|
export const ComposePost = observer(function ComposePost({
|
||||||
|
@ -255,6 +256,16 @@ export const ComposePost = observer(function ComposePost({
|
||||||
setIsProcessing(false)
|
setIsProcessing(false)
|
||||||
return
|
return
|
||||||
} finally {
|
} finally {
|
||||||
|
if (postUri) {
|
||||||
|
logEvent('post:create', {
|
||||||
|
imageCount: gallery.size,
|
||||||
|
isReply: replyTo != null,
|
||||||
|
hasLink: extLink != null,
|
||||||
|
hasQuote: quote != null,
|
||||||
|
langs: langPrefs.postLanguage,
|
||||||
|
logContext: 'Composer',
|
||||||
|
})
|
||||||
|
}
|
||||||
track('Create Post', {
|
track('Create Post', {
|
||||||
imageCount: gallery.size,
|
imageCount: gallery.size,
|
||||||
})
|
})
|
||||||
|
|
|
@ -33,6 +33,7 @@ import {useLingui} from '@lingui/react'
|
||||||
import {DiscoverFallbackHeader} from './DiscoverFallbackHeader'
|
import {DiscoverFallbackHeader} from './DiscoverFallbackHeader'
|
||||||
import {FALLBACK_MARKER_POST} from '#/lib/api/feed/home'
|
import {FALLBACK_MARKER_POST} from '#/lib/api/feed/home'
|
||||||
import {useInitialNumToRender} from 'lib/hooks/useInitialNumToRender'
|
import {useInitialNumToRender} from 'lib/hooks/useInitialNumToRender'
|
||||||
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
|
|
||||||
const LOADING_ITEM = {_reactKey: '__loading__'}
|
const LOADING_ITEM = {_reactKey: '__loading__'}
|
||||||
const EMPTY_FEED_ITEM = {_reactKey: '__empty__'}
|
const EMPTY_FEED_ITEM = {_reactKey: '__empty__'}
|
||||||
|
@ -223,16 +224,29 @@ let Feed = ({
|
||||||
setIsPTRing(false)
|
setIsPTRing(false)
|
||||||
}, [refetch, track, setIsPTRing, onHasNew])
|
}, [refetch, track, setIsPTRing, onHasNew])
|
||||||
|
|
||||||
|
const feedType = feed.split('|')[0]
|
||||||
const onEndReached = React.useCallback(async () => {
|
const onEndReached = React.useCallback(async () => {
|
||||||
if (isFetching || !hasNextPage || isError) return
|
if (isFetching || !hasNextPage || isError) return
|
||||||
|
|
||||||
|
logEvent('feed:endReached', {
|
||||||
|
feedType: feedType,
|
||||||
|
itemCount: feedItems.length,
|
||||||
|
})
|
||||||
track('Feed:onEndReached')
|
track('Feed:onEndReached')
|
||||||
try {
|
try {
|
||||||
await fetchNextPage()
|
await fetchNextPage()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error('Failed to load more posts', {message: err})
|
logger.error('Failed to load more posts', {message: err})
|
||||||
}
|
}
|
||||||
}, [isFetching, hasNextPage, isError, fetchNextPage, track])
|
}, [
|
||||||
|
isFetching,
|
||||||
|
hasNextPage,
|
||||||
|
isError,
|
||||||
|
fetchNextPage,
|
||||||
|
track,
|
||||||
|
feedType,
|
||||||
|
feedItems.length,
|
||||||
|
])
|
||||||
|
|
||||||
const onPressTryAgain = React.useCallback(() => {
|
const onPressTryAgain = React.useCallback(() => {
|
||||||
refetch()
|
refetch()
|
||||||
|
|
Loading…
Reference in New Issue