diff options
Diffstat (limited to 'src/state/queries/usePostThread/utils.ts')
-rw-r--r-- | src/state/queries/usePostThread/utils.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/state/queries/usePostThread/utils.ts b/src/state/queries/usePostThread/utils.ts index b8ab340d8..265bf7f5f 100644 --- a/src/state/queries/usePostThread/utils.ts +++ b/src/state/queries/usePostThread/utils.ts @@ -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) } |