From 4458b031732149d6f9c107582b9e4ec343385518 Mon Sep 17 00:00:00 2001 From: dan Date: Sun, 12 May 2024 18:30:00 +0100 Subject: [PATCH] FeedFeedback fixes (#3968) * Lower seen threshold to 1.5s * Send feedContext for replies * Use a simpler and more reliable feedContext fallback --------- Co-authored-by: Paul Frazee --- src/lib/api/feed-manip.ts | 4 ++++ src/state/queries/post-feed.ts | 2 +- src/view/com/util/List.tsx | 2 +- src/view/com/util/List.web.tsx | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/api/feed-manip.ts b/src/lib/api/feed-manip.ts index 85089608..3902a565 100644 --- a/src/lib/api/feed-manip.ts +++ b/src/lib/api/feed-manip.ts @@ -71,6 +71,10 @@ export class FeedViewPostsSlice { ?.__source as ReasonFeedSource } + get feedContext() { + return this.items.find(item => item.feedContext)?.feedContext + } + containsUri(uri: string) { return !!this.items.find(item => item.post.uri === uri) } diff --git a/src/state/queries/post-feed.ts b/src/state/queries/post-feed.ts index 7b312edf..e670e9da 100644 --- a/src/state/queries/post-feed.ts +++ b/src/state/queries/post-feed.ts @@ -303,7 +303,7 @@ export function usePostFeedQuery( i === 0 && slice.source ? slice.source : item.reason, - feedContext: item.feedContext, + feedContext: item.feedContext || slice.feedContext, moderation: moderations[i], } } diff --git a/src/view/com/util/List.tsx b/src/view/com/util/List.tsx index 0064a7b8..90f5905f 100644 --- a/src/view/com/util/List.tsx +++ b/src/view/com/util/List.tsx @@ -90,7 +90,7 @@ function ListImpl( }, { itemVisiblePercentThreshold: 40, - minimumViewTime: 2e3, + minimumViewTime: 1.5e3, }, ] }, [onItemSeen]) diff --git a/src/view/com/util/List.web.tsx b/src/view/com/util/List.web.tsx index a64f7acf..df097baf 100644 --- a/src/view/com/util/List.web.tsx +++ b/src/view/com/util/List.web.tsx @@ -27,7 +27,7 @@ export type ListProps = Omit< } export type ListRef = React.MutableRefObject // TODO: Better types. -const ON_ITEM_SEEN_WAIT_DURATION = 2e3 // post must be "seen" 2 seconds before capturing +const ON_ITEM_SEEN_WAIT_DURATION = 1.5e3 // when we consider post to be "seen" const ON_ITEM_SEEN_INTERSECTION_OPTS = { rootMargin: '-200px 0px -200px 0px', } // post must be 200px visible to be "seen"