[Statsig] Sample noisy events (#4288)
* Sample state:background and state:foreground * Sample feed events * Add DEV protection against forgetting to add events to the list
This commit is contained in:
@@ -15,7 +15,7 @@ const AnimatedPagerView = Animated.createAnimatedComponent(PagerView)
|
||||
export interface PagerRef {
|
||||
setPage: (
|
||||
index: number,
|
||||
reason: LogEvents['home:feedDisplayed']['reason'],
|
||||
reason: LogEvents['home:feedDisplayed:sampled']['reason'],
|
||||
) => void
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ interface Props {
|
||||
onPageSelected?: (index: number) => void
|
||||
onPageSelecting?: (
|
||||
index: number,
|
||||
reason: LogEvents['home:feedDisplayed']['reason'],
|
||||
reason: LogEvents['home:feedDisplayed:sampled']['reason'],
|
||||
) => void
|
||||
onPageScrollStateChanged?: (
|
||||
scrollState: 'idle' | 'dragging' | 'settling',
|
||||
@@ -61,7 +61,7 @@ export const Pager = forwardRef<PagerRef, React.PropsWithChildren<Props>>(
|
||||
React.useImperativeHandle(ref, () => ({
|
||||
setPage: (
|
||||
index: number,
|
||||
reason: LogEvents['home:feedDisplayed']['reason'],
|
||||
reason: LogEvents['home:feedDisplayed:sampled']['reason'],
|
||||
) => {
|
||||
pagerView.current?.setPage(index)
|
||||
onPageSelecting?.(index, reason)
|
||||
|
||||
@@ -18,7 +18,7 @@ interface Props {
|
||||
onPageSelected?: (index: number) => void
|
||||
onPageSelecting?: (
|
||||
index: number,
|
||||
reason: LogEvents['home:feedDisplayed']['reason'],
|
||||
reason: LogEvents['home:feedDisplayed:sampled']['reason'],
|
||||
) => void
|
||||
}
|
||||
export const Pager = React.forwardRef(function PagerImpl(
|
||||
@@ -38,14 +38,17 @@ export const Pager = React.forwardRef(function PagerImpl(
|
||||
React.useImperativeHandle(ref, () => ({
|
||||
setPage: (
|
||||
index: number,
|
||||
reason: LogEvents['home:feedDisplayed']['reason'],
|
||||
reason: LogEvents['home:feedDisplayed:sampled']['reason'],
|
||||
) => {
|
||||
onTabBarSelect(index, reason)
|
||||
},
|
||||
}))
|
||||
|
||||
const onTabBarSelect = React.useCallback(
|
||||
(index: number, reason: LogEvents['home:feedDisplayed']['reason']) => {
|
||||
(
|
||||
index: number,
|
||||
reason: LogEvents['home:feedDisplayed:sampled']['reason'],
|
||||
) => {
|
||||
const scrollY = window.scrollY
|
||||
// We want to determine if the tabbar is already "sticking" at the top (in which
|
||||
// case we should preserve and restore scroll), or if it is somewhere below in the
|
||||
|
||||
Reference in New Issue
Block a user