Skip to content

Commit

Permalink
[fix] regression in marking posts read on scroll (#1069)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions Bot <>
  • Loading branch information
gkasdorf authored Nov 6, 2023
1 parent 20709e6 commit 8f2b4ba
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/components/Feed/components/MainFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,12 @@ export default function MainFeed(): React.JSX.Element {
}, []);

const onViewableItemsChanged = useCallback(
({ viewableItems }: ViewableItemsChanged<number>) => {
({ viewableItems }: ViewableItemsChanged<PostPair>) => {
const item = viewableItems?.[0]?.item;

// If viewable items is null or empty, just return now
if (item == null) return;

/*
This is a weird situation where we can't use the hook to get these setting values. FlashList does not support
updating the viewability config on the fly and as a result we have to resort to this.
*/
const markReadOnFeedScroll =
useSettingsStore.getState().readOptions.onFeedScroll;
const markReadOnCommunityScroll =
Expand All @@ -82,7 +78,7 @@ export default function MainFeed(): React.JSX.Element {
) {
// Mark the first viewable post as read
setPostRead({
postId: item,
postId: item.postId,
});
}
},
Expand Down

0 comments on commit 8f2b4ba

Please sign in to comment.