Fix isPartOfLastBranchFromDepth assignment (#8856)

This commit is contained in:
Eric Bailey
2025-08-19 11:33:46 -05:00
committed by GitHub
parent 4923786927
commit ea7f984a40
2 changed files with 11 additions and 4 deletions
+9 -2
View File
@@ -307,9 +307,16 @@ export function sortAndAnnotateThreadItems(
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.parentMetadata.isPartOfLastBranchFromDepth
}