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)) { } else if (AppBskyUnspeccedDefs.isThreadItemPost(item.value)) {
if (parentMetadata) { if (parentMetadata) {
/* /*
* Set this value before incrementing the parent's repliesSeenCount * Set this value before incrementing the parent's repliesSeenCounter
*/ */
metadata!.replyIndex = parentMetadata.repliesIndexCount metadata!.replyIndex = parentMetadata.repliesIndexCounter
// Increment the parent's repliesIndexCount // Increment the parent's repliesIndexCounter
parentMetadata.repliesIndexCount += 1 parentMetadata.repliesIndexCounter += 1
} }
const post = views.threadPost({ const post = views.threadPost({
@@ -160,7 +160,7 @@ export function sortAndAnnotateThreadItems(
* Update seen reply count of parent * Update seen reply count of parent
*/ */
if (parentMetadata) { if (parentMetadata) {
parentMetadata.repliesSeenCount += 1 parentMetadata.repliesSeenCounter += 1
} }
} else { } else {
/* /*
@@ -193,11 +193,11 @@ export function sortAndAnnotateThreadItems(
storeTraversalMetadata(metadatas, childMetadata) storeTraversalMetadata(metadatas, childMetadata)
if (childParentMetadata) { if (childParentMetadata) {
/* /*
* Set this value before incrementing the parent's repliesIndexCount * Set this value before incrementing the parent's repliesIndexCounter
*/ */
childMetadata!.replyIndex = childMetadata!.replyIndex =
childParentMetadata.repliesIndexCount childParentMetadata.repliesIndexCounter
childParentMetadata.repliesIndexCount += 1 childParentMetadata.repliesIndexCounter += 1
} }
const childPost = views.threadPost({ const childPost = views.threadPost({
@@ -266,7 +266,7 @@ export function sortAndAnnotateThreadItems(
*/ */
metadata.isLastSibling = metadata.isLastSibling =
metadata.replyIndex === metadata.replyIndex ===
metadata.parentMetadata.repliesSeenCount - 1 metadata.parentMetadata.repliesSeenCounter - 1
metadata.isLastChild = metadata.isLastChild =
metadata.nextItemDepth === undefined || metadata.nextItemDepth === undefined ||
metadata.nextItemDepth <= metadata.depth 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. * 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 * 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. * replies that were hydrated in the response.
* *
* After traversal, we can use this to calculate if we actually got all the * After traversal, we can use this to calculate if we actually got all the
* replies we expected, or if some were blocked, etc. * 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 * 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 * for populating the `replyIndex` of the post by referencing this value on
* the parent. * the parent.
*/ */
repliesIndexCount: number repliesIndexCounter: number
/** /**
* The index-0-based index of this reply in the parent post's replies. * 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, repliesCount,
repliesUnhydrated, repliesUnhydrated,
repliesSeenCount: 0, repliesSeenCounter: 0,
repliesIndexCount: 0, repliesIndexCounter: 0,
replyIndex: 0, replyIndex: 0,
skippedIndentIndices: new Set<number>(), skippedIndentIndices: new Set<number>(),
} }
@@ -126,7 +126,7 @@ export function getThreadPostUI({
prevItemDepth, prevItemDepth,
isLastChild, isLastChild,
skippedIndentIndices, skippedIndentIndices,
repliesSeenCount, repliesSeenCounter,
repliesUnhydrated, repliesUnhydrated,
precedesChildReadMore, precedesChildReadMore,
followsReadMoreUp, followsReadMoreUp,
@@ -134,8 +134,8 @@ export function getThreadPostUI({
const isReplyAndHasReplies = const isReplyAndHasReplies =
depth > 0 && depth > 0 &&
repliesCount > 0 && repliesCount > 0 &&
(repliesCount - repliesUnhydrated === repliesSeenCount || (repliesCount - repliesUnhydrated === repliesSeenCounter ||
repliesSeenCount > 0) repliesSeenCounter > 0)
return { return {
isAnchor: depth === 0, isAnchor: depth === 0,
showParentReplyLine: showParentReplyLine: