Update naming

This commit is contained in:
Eric Bailey
2025-05-30 09:41:03 -05:00
parent cc4da37bab
commit a7a9da03d0
3 changed files with 6 additions and 7 deletions
+3 -4
View File
@@ -145,7 +145,7 @@ export function traverse(
/*
* Set this value before incrementing the parent's repliesSeenCount
*/
metadata!.repliesIndex = parentMetadata.repliesIndexCount
metadata!.replyIndex = parentMetadata.repliesIndexCount
// Increment the parent's repliesIndexCount
parentMetadata.repliesIndexCount += 1
}
@@ -211,7 +211,7 @@ export function traverse(
/*
* Set this value before incrementing the parent's repliesIndexCount
*/
childMetadata!.repliesIndex =
childMetadata!.replyIndex =
childParentMetadata.repliesIndexCount
childParentMetadata.repliesIndexCount += 1
}
@@ -328,8 +328,7 @@ export function traverse(
* based on the actual data that we've seen.
*/
metadata.isLastSibling =
metadata.repliesIndex ===
metadata.parentMetadata.repliesSeenCount - 1
metadata.replyIndex === metadata.parentMetadata.repliesSeenCount - 1
metadata.isLastChild =
metadata.nextItemDepth === undefined ||
metadata.nextItemDepth <= metadata.depth
+2 -2
View File
@@ -161,14 +161,14 @@ export type TraversalMetadata = {
repliesSeenCount: number
/**
* The total number of replies to this post hydrated in this response. Used
* for populating the `repliesIndex` of the post by referencing this value on
* for populating the `replyIndex` of the post by referencing this value on
* the parent.
*/
repliesIndexCount: number
/**
* The index-0-based index of this reply in the parent post's replies.
*/
repliesIndex: number
replyIndex: number
/**
* Each slice is responsible for rendering reply lines based on its depth.
* This value corresponds to any line indices that can be skipped e.g.
+1 -1
View File
@@ -87,7 +87,7 @@ export function getTraversalMetadata({
repliesUnhydrated,
repliesSeenCount: 0,
repliesIndexCount: 0,
repliesIndex: 0,
replyIndex: 0,
skippedIndentIndices: new Set<number>(),
}