Debug: disable feed reordering to isolate bugs

zio/stable
Paul Frazee 2022-12-13 11:15:32 -06:00
parent e37ac91bee
commit 9e1bb898f0
1 changed files with 26 additions and 21 deletions

View File

@ -551,29 +551,34 @@ function preprocessFeed(
feed: FeedItem[],
dedup: boolean,
): FeedItemWithThreadMeta[] {
const reorg: FeedItemWithThreadMeta[] = []
for (let i = feed.length - 1; i >= 0; i--) {
const item = feed[i] as FeedItemWithThreadMeta
// DEBUG
// this has been temporarily disabled to see if it's the cause of some bugs
// if the issues go away, we know this was the cause
// -prf
return feed
// const reorg: FeedItemWithThreadMeta[] = []
// for (let i = feed.length - 1; i >= 0; i--) {
// const item = feed[i] as FeedItemWithThreadMeta
if (dedup) {
if (reorg.find(item2 => item2.uri === item.uri)) {
continue
}
}
// if (dedup) {
// if (reorg.find(item2 => item2.uri === item.uri)) {
// continue
// }
// }
const selfReplyUri = getSelfReplyUri(item)
if (selfReplyUri) {
const parentIndex = reorg.findIndex(item2 => item2.uri === selfReplyUri)
if (parentIndex !== -1 && !reorg[parentIndex]._isThreadParent) {
reorg[parentIndex]._isThreadParent = true
item._isThreadChild = true
reorg.splice(parentIndex + 1, 0, item)
continue
}
}
reorg.unshift(item)
}
return reorg
// const selfReplyUri = getSelfReplyUri(item)
// if (selfReplyUri) {
// const parentIndex = reorg.findIndex(item2 => item2.uri === selfReplyUri)
// if (parentIndex !== -1 && !reorg[parentIndex]._isThreadParent) {
// reorg[parentIndex]._isThreadParent = true
// item._isThreadChild = true
// reorg.splice(parentIndex + 1, 0, item)
// continue
// }
// }
// reorg.unshift(item)
// }
// return reorg
}
function getSelfReplyUri(