Fix isPartOfLastBranchFromDepth assignment (#8856)
This commit is contained in:
@@ -307,9 +307,16 @@ export function sortAndAnnotateThreadItems(
|
|||||||
metadata.isPartOfLastBranchFromDepth = metadata.depth
|
metadata.isPartOfLastBranchFromDepth = metadata.depth
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the parent is part of the last branch of the sub-tree, so is the child.
|
* If the parent is part of the last branch of the sub-tree, so
|
||||||
|
* is the child. However, if the child is also a last sibling,
|
||||||
|
* then we need to start tracking `isPartOfLastBranchFromDepth`
|
||||||
|
* from this point onwards, always updating it to the depth of
|
||||||
|
* the last sibling as we go down.
|
||||||
*/
|
*/
|
||||||
if (metadata.parentMetadata.isPartOfLastBranchFromDepth) {
|
if (
|
||||||
|
!metadata.isLastSibling &&
|
||||||
|
metadata.parentMetadata.isPartOfLastBranchFromDepth
|
||||||
|
) {
|
||||||
metadata.isPartOfLastBranchFromDepth =
|
metadata.isPartOfLastBranchFromDepth =
|
||||||
metadata.parentMetadata.isPartOfLastBranchFromDepth
|
metadata.parentMetadata.isPartOfLastBranchFromDepth
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,8 +151,8 @@ export type TraversalMetadata = {
|
|||||||
*/
|
*/
|
||||||
isLastChild: boolean
|
isLastChild: boolean
|
||||||
/**
|
/**
|
||||||
* Indicates if the post is the left/lower-most branch of the reply tree.
|
* Indicates if the post is the left-most AND lower-most branch of the reply
|
||||||
* Value corresponds to the depth at which this branch started.
|
* tree. Value corresponds to the depth at which this branch started.
|
||||||
*/
|
*/
|
||||||
isPartOfLastBranchFromDepth?: number
|
isPartOfLastBranchFromDepth?: number
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user