Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix v2 tree view bug caused by moderation settings (#8503)

* Use actual index, not seen index

* Handle edge case where last sibling is moderated

authored by

Eric Bailey and committed by
GitHub
c2b71a6a 585dbebb

+28 -4
+28 -4
src/state/queries/usePostThread/traversal.ts
··· 265 265 metadata.nextItemDepth = nextItem?.depth 266 266 267 267 /* 268 - * We can now officially calculate `isLastSibling` and `isLastChild` 269 - * based on the actual data that we've seen. 268 + * Item is the last "sibling" if we know for sure we're out of 269 + * replies on the parent (even though this item itself may have its 270 + * own reply branches). 270 271 */ 271 - metadata.isLastSibling = 272 + const isLastSiblingByCounts = 272 273 metadata.replyIndex === 273 - metadata.parentMetadata.repliesSeenCounter - 1 274 + metadata.parentMetadata.repliesIndexCounter - 1 275 + 276 + /* 277 + * Item can also be the last "sibling" if we know we don't have a 278 + * next item, OR if that next item's depth is less than this item's 279 + * depth (meaning it's a sibling of the parent, not a child of this 280 + * item). 281 + */ 282 + const isImplicitlyLastSibling = 283 + metadata.nextItemDepth === undefined || 284 + metadata.nextItemDepth < metadata.depth 285 + 286 + /* 287 + * Ok now we can set the last sibling state. 288 + */ 289 + metadata.isLastSibling = 290 + isLastSiblingByCounts || isImplicitlyLastSibling 291 + 292 + /* 293 + * Item is the last "child" in a branch if there is no next item, 294 + * or if the next item's depth is less than this item's depth (a 295 + * sibling of the parent) or equal to this item's depth (a sibling 296 + * of this item) 297 + */ 274 298 metadata.isLastChild = 275 299 metadata.nextItemDepth === undefined || 276 300 metadata.nextItemDepth <= metadata.depth