Fix to thread ordering in the feed: correctly identify the starts of threads when adjacent

zio/stable
Paul Frazee 2022-12-19 13:22:18 -06:00
parent ae3099dfca
commit e99eb7bfad
1 changed files with 5 additions and 2 deletions

View File

@ -601,7 +601,11 @@ function preprocessFeed(feed: FeedItem[]): FeedItemWithThreadMeta[] {
} else { } else {
if (!item._isThreadChild) { if (!item._isThreadChild) {
threadSlices.push({index: activeSlice, length: i - activeSlice}) threadSlices.push({index: activeSlice, length: i - activeSlice})
activeSlice = -1 if (item._isThreadParent) {
activeSlice = i
} else {
activeSlice = -1
}
} }
} }
} }
@ -630,7 +634,6 @@ function preprocessFeed(feed: FeedItem[]): FeedItemWithThreadMeta[] {
if (slice.length > 3) { if (slice.length > 3) {
reorg.splice(slice.index - removedCount + 1, slice.length - 3) reorg.splice(slice.index - removedCount + 1, slice.length - 3)
reorg[slice.index - removedCount]._isThreadChildElided = true reorg[slice.index - removedCount]._isThreadChildElided = true
console.log(reorg[slice.index - removedCount])
removedCount += slice.length - 3 removedCount += slice.length - 3
} }
} }