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 * Set this value before incrementing the parent's repliesSeenCount
*/ */
metadata!.repliesIndex = parentMetadata.repliesIndexCount metadata!.replyIndex = parentMetadata.repliesIndexCount
// Increment the parent's repliesIndexCount // Increment the parent's repliesIndexCount
parentMetadata.repliesIndexCount += 1 parentMetadata.repliesIndexCount += 1
} }
@@ -211,7 +211,7 @@ export function traverse(
/* /*
* Set this value before incrementing the parent's repliesIndexCount * Set this value before incrementing the parent's repliesIndexCount
*/ */
childMetadata!.repliesIndex = childMetadata!.replyIndex =
childParentMetadata.repliesIndexCount childParentMetadata.repliesIndexCount
childParentMetadata.repliesIndexCount += 1 childParentMetadata.repliesIndexCount += 1
} }
@@ -328,8 +328,7 @@ export function traverse(
* based on the actual data that we've seen. * based on the actual data that we've seen.
*/ */
metadata.isLastSibling = metadata.isLastSibling =
metadata.repliesIndex === metadata.replyIndex === metadata.parentMetadata.repliesSeenCount - 1
metadata.parentMetadata.repliesSeenCount - 1
metadata.isLastChild = metadata.isLastChild =
metadata.nextItemDepth === undefined || metadata.nextItemDepth === undefined ||
metadata.nextItemDepth <= metadata.depth metadata.nextItemDepth <= metadata.depth
+2 -2
View File
@@ -161,14 +161,14 @@ export type TraversalMetadata = {
repliesSeenCount: number repliesSeenCount: 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 `repliesIndex` 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 repliesIndexCount: 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.
*/ */
repliesIndex: number replyIndex: number
/** /**
* Each slice is responsible for rendering reply lines based on its depth. * 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. * 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, repliesUnhydrated,
repliesSeenCount: 0, repliesSeenCount: 0,
repliesIndexCount: 0, repliesIndexCount: 0,
repliesIndex: 0, replyIndex: 0,
skippedIndentIndices: new Set<number>(), skippedIndentIndices: new Set<number>(),
} }