about summary refs log tree commit diff
path: root/src/state/models/feed-view.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-12-20 09:02:38 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-12-20 09:02:38 -0600
commit71e4b3d756d992591a57829349179f725146ff15 (patch)
tree77c38cf0c6939c4d39549f4ad4f2f882e79b9bf5 /src/state/models/feed-view.ts
parent0401dfc5d3d0f40529aab75aeaacdb3633522f59 (diff)
downloadvoidsky-71e4b3d756d992591a57829349179f725146ff15.tar.zst
Fix to error condition that breaks the feed
Diffstat (limited to 'src/state/models/feed-view.ts')
-rw-r--r--src/state/models/feed-view.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/state/models/feed-view.ts b/src/state/models/feed-view.ts
index ad16d4815..7be9e4494 100644
--- a/src/state/models/feed-view.ts
+++ b/src/state/models/feed-view.ts
@@ -607,9 +607,10 @@ function preprocessFeed(feed: FeedItem[]): FeedItemWithThreadMeta[] {
       slice.length,
     )
     const targetDate = new Date(removed[removed.length - 1].indexedAt)
-    const newIndex = reorg.findIndex(
+    let newIndex = reorg.findIndex(
       item => new Date(item.indexedAt) < targetDate,
     )
+    if (newIndex === -1) newIndex = 0
     reorg.splice(newIndex, 0, ...removed)
     slice.index = newIndex
   }