The counters serve the same purpose, we only need to know the count of the actual replies rendered to the view in order to calculate the replyIndex

This commit is contained in:
Eric Bailey
2025-10-14 15:52:52 -05:00
parent fceec83e08
commit 92f58c8723
3 changed files with 17 additions and 26 deletions
+7 -8
View File
@@ -135,11 +135,11 @@ export function sortAndAnnotateThreadItems(
} else if (AppBskyUnspeccedDefs.isThreadItemPost(item.value)) {
if (parentMetadata) {
/*
* Set this value before incrementing the `repliesIndexCounter`, since
* `repliesIndexCounter` is 1-indexed and `replyIndex` is 0-indexed.
* Set this value before incrementing the `repliesSeenCounter` later
* on, since `repliesSeenCounter` is 1-indexed and `replyIndex` is
* 0-indexed.
*/
metadata!.replyIndex = parentMetadata.repliesIndexCounter
parentMetadata.repliesIndexCounter += 1
metadata!.replyIndex = parentMetadata.repliesSeenCounter
}
const post = views.threadPost({
@@ -194,12 +194,11 @@ export function sortAndAnnotateThreadItems(
if (childParentMetadata) {
/*
* Set this value before incrementing the
* `repliesIndexCounter`, since `repliesIndexCounter` is
* 1-indexed and `replyIndex` is 0-indexed.
* `repliesSeenCounter` later on, since `repliesSeenCounter`
* is 1-indexed and `replyIndex` is 0-indexed.
*/
childMetadata!.replyIndex =
childParentMetadata.repliesIndexCounter
childParentMetadata.repliesIndexCounter += 1
childParentMetadata.repliesSeenCounter
}
const childPost = views.threadPost({