An ATproto social media client -- with an independent Appview.

Fix parent read more occurring further up the tree (#8729)

authored by

Eric Bailey and committed by
GitHub
1504ce28 6d0c859d

+10 -5
+10 -5
src/state/queries/usePostThread/traversal.ts
··· 372 372 /* 373 373 * Tree-view only. 374 374 * 375 - * If there's an upcoming parent read more, this branch is part of the 376 - * last branch of the sub-tree, and the item itself is the last child, 377 - * insert the parent "read more". 375 + * If there's an upcoming parent read more, this branch is part of a 376 + * branch of the sub-tree that is deeper than the 377 + * `upcomingParentReadMore`, and the item following the current item 378 + * is either undefined or less-or-equal-to the depth of the 379 + * `upcomingParentReadMore`, then we know it's time to drop in the 380 + * parent read more. 378 381 */ 379 382 if ( 380 383 view === 'tree' && 381 384 metadata.upcomingParentReadMore && 382 - metadata.isPartOfLastBranchFromDepth === 385 + metadata.isPartOfLastBranchFromDepth && 386 + metadata.isPartOfLastBranchFromDepth >= 383 387 metadata.upcomingParentReadMore.depth && 384 - metadata.isLastChild 388 + (metadata.nextItemDepth === undefined || 389 + metadata.nextItemDepth <= metadata.upcomingParentReadMore.depth) 385 390 ) { 386 391 subset.splice( 387 392 i + 1,