Fix bug where replying to grandparents re-orders thread (#8662)

* Fix bug where optimistic replies were inserted above the root post

* Rename variables for clarity
This commit is contained in:
Eric Bailey
2025-07-17 13:22:09 -05:00
committed by GitHub
parent d13a2e5f69
commit 00b017804b
2 changed files with 32 additions and 23 deletions
+6
View File
@@ -33,6 +33,12 @@ export function getRootPostAtUri(post: AppBskyFeedDefs.PostView) {
AppBskyFeedPost.isRecord,
)
) {
/**
* If the record has no `reply` field, it is a root post.
*/
if (!post.record.reply) {
return new AtUri(post.uri)
}
if (post.record.reply?.root?.uri) {
return new AtUri(post.record.reply.root.uri)
}