Fix to error condition that breaks the feed

This commit is contained in:
Paul Frazee
2022-12-20 09:02:38 -06:00
parent 395a8838be
commit 5c71f8e32a
+2 -1
View File
@@ -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
}