Skip to content

Commit

Permalink
FeedFeedback fixes (#3968)
Browse files Browse the repository at this point in the history
* Lower seen threshold to 1.5s

* Send feedContext for replies

* Use a simpler and more reliable feedContext fallback

---------

Co-authored-by: Paul Frazee <[email protected]>
  • Loading branch information
gaearon and pfrazee authored May 12, 2024
1 parent 97750c4 commit 4458b03
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/lib/api/feed-manip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/state/queries/post-feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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],
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/com/util/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function ListImpl<ItemT>(
},
{
itemVisiblePercentThreshold: 40,
minimumViewTime: 2e3,
minimumViewTime: 1.5e3,
},
]
}, [onItemSeen])
Expand Down
2 changes: 1 addition & 1 deletion src/view/com/util/List.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type ListProps<ItemT> = Omit<
}
export type ListRef = React.MutableRefObject<any | null> // 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"
Expand Down

0 comments on commit 4458b03

Please sign in to comment.