Little cleanup, inserting dupes

This commit is contained in:
Eric Bailey
2025-05-17 10:30:12 -07:00
parent 4a83579795
commit e82627cf4f
3 changed files with 64 additions and 58 deletions
+4 -2
View File
@@ -44,6 +44,7 @@ import {useSafeAreaInsets} from 'react-native-safe-area-context'
import {type ImagePickerAsset} from 'expo-image-picker'
import {
AppBskyFeedDefs,
AppBskyUnspeccedDefs,
type AppBskyFeedGetPostThread,
type BskyAgent,
type RichText,
@@ -404,16 +405,17 @@ export const ComposePost = ({
try {
if (postUri) {
posts = await retry(5, _e => true, async () => {
const res = await agent.app.bsky.feed.getPostThreadV2({
const res = await agent.app.bsky.unspecced.getPostThreadV2({
uri: postUri!,
above: 0,
below: thread.posts.length - 1,
branchingFactor: 1,
})
if (res.data.thread.length !== thread.posts.length) {
throw new Error(`Not ready`)
}
const anchor = res.data.thread.at(0)
if (!AppBskyFeedDefs.isThreadItemPost(anchor)) {
if (!AppBskyUnspeccedDefs.isThreadItemPost(anchor)) {
throw new Error(`Not ready`)
}
return res.data.thread
+3 -3
View File
@@ -3,7 +3,7 @@ import {StyleSheet, useWindowDimensions, View} from 'react-native'
import {useFocusEffect} from '@react-navigation/native'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {AppBskyFeedDefs} from '@atproto/api'
import {AppBskyUnspeccedDefs} from '@atproto/api'
import {isNative} from '#/platform/detection'
import {cleanError} from '#/lib/strings/errors'
@@ -149,8 +149,8 @@ export function Inner({uri}: {uri: string | undefined}) {
const optimisticOnPostReply = ({
post,
}: {
post: AppBskyFeedDefs.ThreadItemPost,
}) => (_: any, posts: AppBskyFeedDefs.ThreadItemPost[]) => {
post: AppBskyUnspeccedDefs.ThreadItemPost,
}) => (_: any, posts: AppBskyUnspeccedDefs.ThreadItemPost[]) => {
if (posts.length) {
// TODO get parent and update reply count?
insertReplies(post.uri, posts)