Bump replies (#2604)

* fix: bump replies

* refactor: only bump if not at 0
zio/stable
Mary 2024-02-06 06:44:14 +07:00 committed by GitHub
parent 6ad5863573
commit 2754121f67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 3 deletions

View File

@ -168,14 +168,25 @@ export class FeedTuner {
const selfReplyUri = getSelfReplyUri(item) const selfReplyUri = getSelfReplyUri(item)
if (selfReplyUri) { if (selfReplyUri) {
const parent = slices.find(item2 => const index = slices.findIndex(slice =>
item2.isNextInThread(selfReplyUri), slice.isNextInThread(selfReplyUri),
) )
if (parent) {
if (index !== -1) {
const parent = slices[index]
parent.insert(item) parent.insert(item)
// If our slice isn't currently on the top, reinsert it to the top.
if (index !== 0) {
slices.splice(index, 1)
slices.unshift(parent)
}
continue continue
} }
} }
slices.unshift(new FeedViewPostsSlice([item])) slices.unshift(new FeedViewPostsSlice([item]))
} }
} }