about summary refs log tree commit diff
path: root/src/view/com/posts/Feed.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2023-12-07 15:44:22 -0600
committerGitHub <noreply@github.com>2023-12-07 13:44:22 -0800
commit174a1622c9dc34d580d3deb1f52f85aec4ac9f42 (patch)
treed9b6ffe6c8ba20500f55ec7256282e09064fa45f /src/view/com/posts/Feed.tsx
parent940fc0ea5c3aefb49f39d8de9398a306882ed567 (diff)
downloadvoidsky-174a1622c9dc34d580d3deb1f52f85aec4ac9f42.tar.zst
Hoist moderation, attempt to fill feed up to 30 (#2134)
* Move moderatePost up to feed query

* Attemt to fill page up to 30

* Add the 'ensure full page' behavior to notifs

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/view/com/posts/Feed.tsx')
-rw-r--r--src/view/com/posts/Feed.tsx30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/view/com/posts/Feed.tsx b/src/view/com/posts/Feed.tsx
index 371f73b87..03fa95eea 100644
--- a/src/view/com/posts/Feed.tsx
+++ b/src/view/com/posts/Feed.tsx
@@ -27,7 +27,6 @@ import {
   usePostFeedQuery,
   pollLatest,
 } from '#/state/queries/post-feed'
-import {useModerationOpts} from '#/state/queries/preferences'
 import {isWeb} from '#/platform/detection'
 import {listenPostCreated} from '#/state/events'
 import {useSession} from '#/state/session'
@@ -82,8 +81,10 @@ let Feed = ({
   const [isPTRing, setIsPTRing] = React.useState(false)
   const checkForNewRef = React.useRef<(() => void) | null>(null)
 
-  const moderationOpts = useModerationOpts()
-  const opts = React.useMemo(() => ({enabled}), [enabled])
+  const opts = React.useMemo(
+    () => ({enabled, ignoreFilterFor}),
+    [enabled, ignoreFilterFor],
+  )
   const {
     data,
     isFetching,
@@ -144,7 +145,7 @@ let Feed = ({
 
   const feedItems = React.useMemo(() => {
     let arr: any[] = []
-    if (isFetched && moderationOpts) {
+    if (isFetched) {
       if (isError && isEmpty) {
         arr = arr.concat([ERROR_ITEM])
       }
@@ -162,7 +163,7 @@ let Feed = ({
       arr.push(LOADING_ITEM)
     }
     return arr
-  }, [isFetched, isError, isEmpty, data, moderationOpts])
+  }, [isFetched, isError, isEmpty, data])
 
   // events
   // =
@@ -224,24 +225,9 @@ let Feed = ({
       } else if (item === LOADING_ITEM) {
         return <PostFeedLoadingPlaceholder />
       }
-      return (
-        <FeedSlice
-          slice={item}
-          // we check for this before creating the feedItems array
-          moderationOpts={moderationOpts!}
-          ignoreFilterFor={ignoreFilterFor}
-        />
-      )
+      return <FeedSlice slice={item} />
     },
-    [
-      feed,
-      error,
-      onPressTryAgain,
-      onPressRetryLoadMore,
-      renderEmptyState,
-      moderationOpts,
-      ignoreFilterFor,
-    ],
+    [feed, error, onPressTryAgain, onPressRetryLoadMore, renderEmptyState],
   )
 
   const shouldRenderEndOfFeed =