diff options
author | Eric Bailey <git@esb.lol> | 2025-07-28 14:21:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-28 14:21:01 -0500 |
commit | 1504ce28e2abf390955b1eb6e4d5742935c2055d (patch) | |
tree | bb27b06e5df106ed5715b2d28d2939e2b7a884e8 /src/state/queries/usePostThread | |
parent | 6d0c859d8f7517fd895f7a186375ff3d26381c22 (diff) | |
download | voidsky-1504ce28e2abf390955b1eb6e4d5742935c2055d.tar.zst |
Fix parent read more occurring further up the tree (#8729)
Diffstat (limited to 'src/state/queries/usePostThread')
-rw-r--r-- | src/state/queries/usePostThread/traversal.ts | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/state/queries/usePostThread/traversal.ts b/src/state/queries/usePostThread/traversal.ts index 7d8cd6464..2809d32e9 100644 --- a/src/state/queries/usePostThread/traversal.ts +++ b/src/state/queries/usePostThread/traversal.ts @@ -372,16 +372,21 @@ export function sortAndAnnotateThreadItems( /* * Tree-view only. * - * If there's an upcoming parent read more, this branch is part of the - * last branch of the sub-tree, and the item itself is the last child, - * insert the parent "read more". + * If there's an upcoming parent read more, this branch is part of a + * branch of the sub-tree that is deeper than the + * `upcomingParentReadMore`, and the item following the current item + * is either undefined or less-or-equal-to the depth of the + * `upcomingParentReadMore`, then we know it's time to drop in the + * parent read more. */ if ( view === 'tree' && metadata.upcomingParentReadMore && - metadata.isPartOfLastBranchFromDepth === + metadata.isPartOfLastBranchFromDepth && + metadata.isPartOfLastBranchFromDepth >= metadata.upcomingParentReadMore.depth && - metadata.isLastChild + (metadata.nextItemDepth === undefined || + metadata.nextItemDepth <= metadata.upcomingParentReadMore.depth) ) { subset.splice( i + 1, |