From 49b19442255cfe2e40d1af615605157a01bc8bc2 Mon Sep 17 00:00:00 2001
From: dan <dan.abramov@gmail.com>
Date: Mon, 20 Jan 2025 02:11:15 +0000
Subject: Fix Discover posts showing up in Following with no explanation
 (#7500)

---
 src/view/com/posts/PostFeed.tsx | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

(limited to 'src/view/com/posts/PostFeed.tsx')

diff --git a/src/view/com/posts/PostFeed.tsx b/src/view/com/posts/PostFeed.tsx
index 554415faf..4bd971b3f 100644
--- a/src/view/com/posts/PostFeed.tsx
+++ b/src/view/com/posts/PostFeed.tsx
@@ -75,9 +75,8 @@ type FeedRow =
       key: string
     }
   | {
-      type: 'slice' // TODO can we remove?
+      type: 'fallbackMarker'
       key: string
-      slice: FeedPostSlice
     }
   | {
       type: 'sliceItem'
@@ -425,7 +424,13 @@ let PostFeed = ({
                 }
               }
 
-              if (slice.isIncompleteThread && slice.items.length >= 3) {
+              if (slice.isFallbackMarker) {
+                arr.push({
+                  type: 'fallbackMarker',
+                  key:
+                    'sliceFallbackMarker-' + sliceIndex + '-' + lastFetchedAt,
+                })
+              } else if (slice.isIncompleteThread && slice.items.length >= 3) {
                 const beforeLast = slice.items.length - 2
                 const last = slice.items.length - 1
                 arr.push({
@@ -599,15 +604,14 @@ let PostFeed = ({
         return <TrendingInterstitial />
       } else if (row.type === 'interstitialTrendingVideos') {
         return <TrendingVideosInterstitial />
+      } else if (row.type === 'fallbackMarker') {
+        // HACK
+        // tell the user we fell back to discover
+        // see home.ts (feed api) for more info
+        // -prf
+        return <DiscoverFallbackHeader />
       } else if (row.type === 'sliceItem') {
         const slice = row.slice
-        if (slice.isFallbackMarker) {
-          // HACK
-          // tell the user we fell back to discover
-          // see home.ts (feed api) for more info
-          // -prf
-          return <DiscoverFallbackHeader />
-        }
         const indexInSlice = row.indexInSlice
         const item = slice.items[indexInSlice]
         return (
-- 
cgit 1.4.1

