Counter naming

This commit is contained in:
Eric Bailey
2025-06-10 14:42:02 -05:00
parent 54f641c185
commit 878af67254
3 changed files with 17 additions and 17 deletions
+9 -9
View File
@@ -135,11 +135,11 @@ export function sortAndAnnotateThreadItems(
} else if (AppBskyUnspeccedDefs.isThreadItemPost(item.value)) {
if (parentMetadata) {
/*
* Set this value before incrementing the parent's repliesSeenCount
* Set this value before incrementing the parent's repliesSeenCounter
*/
metadata!.replyIndex = parentMetadata.repliesIndexCount
// Increment the parent's repliesIndexCount
parentMetadata.repliesIndexCount += 1
metadata!.replyIndex = parentMetadata.repliesIndexCounter
// Increment the parent's repliesIndexCounter
parentMetadata.repliesIndexCounter += 1
}
const post = views.threadPost({
@@ -160,7 +160,7 @@ export function sortAndAnnotateThreadItems(
* Update seen reply count of parent
*/
if (parentMetadata) {
parentMetadata.repliesSeenCount += 1
parentMetadata.repliesSeenCounter += 1
}
} else {
/*
@@ -193,11 +193,11 @@ export function sortAndAnnotateThreadItems(
storeTraversalMetadata(metadatas, childMetadata)
if (childParentMetadata) {
/*
* Set this value before incrementing the parent's repliesIndexCount
* Set this value before incrementing the parent's repliesIndexCounter
*/
childMetadata!.replyIndex =
childParentMetadata.repliesIndexCount
childParentMetadata.repliesIndexCount += 1
childParentMetadata.repliesIndexCounter
childParentMetadata.repliesIndexCounter += 1
}
const childPost = views.threadPost({
@@ -266,7 +266,7 @@ export function sortAndAnnotateThreadItems(
*/
metadata.isLastSibling =
metadata.replyIndex ===
metadata.parentMetadata.repliesSeenCount - 1
metadata.parentMetadata.repliesSeenCounter - 1
metadata.isLastChild =
metadata.nextItemDepth === undefined ||
metadata.nextItemDepth <= metadata.depth
+3 -3
View File
@@ -195,19 +195,19 @@ export type TraversalMetadata = {
/**
* The number of replies that have been seen so far in the traversal.
* Excludes replies that are moderated in some way, since those are not
* "seen" on first load. Use `repliesIndexCount` for the total number of
* "seen" on first load. Use `repliesIndexCounter` for the total number of
* replies that were hydrated in the response.
*
* After traversal, we can use this to calculate if we actually got all the
* replies we expected, or if some were blocked, etc.
*/
repliesSeenCount: number
repliesSeenCounter: number
/**
* The total number of replies to this post hydrated in this response. Used
* for populating the `replyIndex` of the post by referencing this value on
* the parent.
*/
repliesIndexCount: number
repliesIndexCounter: number
/**
* The index-0-based index of this reply in the parent post's replies.
*/
+5 -5
View File
@@ -92,8 +92,8 @@ export function getTraversalMetadata({
},
repliesCount,
repliesUnhydrated,
repliesSeenCount: 0,
repliesIndexCount: 0,
repliesSeenCounter: 0,
repliesIndexCounter: 0,
replyIndex: 0,
skippedIndentIndices: new Set<number>(),
}
@@ -126,7 +126,7 @@ export function getThreadPostUI({
prevItemDepth,
isLastChild,
skippedIndentIndices,
repliesSeenCount,
repliesSeenCounter,
repliesUnhydrated,
precedesChildReadMore,
followsReadMoreUp,
@@ -134,8 +134,8 @@ export function getThreadPostUI({
const isReplyAndHasReplies =
depth > 0 &&
repliesCount > 0 &&
(repliesCount - repliesUnhydrated === repliesSeenCount ||
repliesSeenCount > 0)
(repliesCount - repliesUnhydrated === repliesSeenCounter ||
repliesSeenCounter > 0)
return {
isAnchor: depth === 0,
showParentReplyLine: