Proper fix to the previous panic fix: put threads at the end when they should be there

zio/stable
Paul Frazee 2022-12-20 09:20:53 -06:00
parent 71e4b3d756
commit 99a28c0aae
1 changed files with 3 additions and 1 deletions

View File

@ -610,7 +610,9 @@ function preprocessFeed(feed: FeedItem[]): FeedItemWithThreadMeta[] {
let newIndex = reorg.findIndex( let newIndex = reorg.findIndex(
item => new Date(item.indexedAt) < targetDate, item => new Date(item.indexedAt) < targetDate,
) )
if (newIndex === -1) newIndex = 0 if (newIndex === -1) {
newIndex = reorg.length
}
reorg.splice(newIndex, 0, ...removed) reorg.splice(newIndex, 0, ...removed)
slice.index = newIndex slice.index = newIndex
} }