make onReply callbacks non reactive
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {memo, useCallback, useMemo} from 'react'
|
||||
import {memo, useMemo} from 'react'
|
||||
import {Text as RNText, View} from 'react-native'
|
||||
import {
|
||||
AppBskyFeedDefs,
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
} from '@atproto/api'
|
||||
import {Plural, Trans, useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||
import {useOpenComposer} from '#/lib/hooks/useOpenComposer'
|
||||
import {makeProfileLink} from '#/lib/routes/links'
|
||||
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||
@@ -245,7 +246,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
|
||||
}
|
||||
}, [postSource])
|
||||
|
||||
const onPressReply = useCallback(() => {
|
||||
const onPressReply = useNonReactiveCallback(() => {
|
||||
openComposer({
|
||||
replyTo: {
|
||||
uri: post.uri,
|
||||
@@ -268,15 +269,7 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
|
||||
reqId: postSource.post.reqId,
|
||||
})
|
||||
}
|
||||
}, [
|
||||
openComposer,
|
||||
post,
|
||||
record,
|
||||
onPostSuccess,
|
||||
moderation,
|
||||
postSource,
|
||||
feedFeedback,
|
||||
])
|
||||
})
|
||||
|
||||
const onOpenAuthor = () => {
|
||||
ax.metric('post:clickthroughAuthor', {
|
||||
|
||||
@@ -11,6 +11,7 @@ import Animated, {useAnimatedStyle} from 'react-native-reanimated'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
|
||||
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
|
||||
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||
import {useOpenComposer} from '#/lib/hooks/useOpenComposer'
|
||||
import {usePostViewTracking} from '#/lib/hooks/usePostViewTracking'
|
||||
import {useFeedFeedback} from '#/state/feed-feedback'
|
||||
@@ -105,7 +106,7 @@ export function PostThread({uri}: {uri: string}) {
|
||||
const trackThreadItemView = usePostViewTracking('PostThreadItem')
|
||||
|
||||
const {openComposer} = useOpenComposer()
|
||||
const optimisticOnPostReply = useCallback(
|
||||
const optimisticOnPostReply = useNonReactiveCallback(
|
||||
(payload: OnPostSuccessData) => {
|
||||
if (payload) {
|
||||
const {replyToUri, posts} = payload
|
||||
@@ -114,9 +115,8 @@ export function PostThread({uri}: {uri: string}) {
|
||||
}
|
||||
}
|
||||
},
|
||||
[thread],
|
||||
)
|
||||
const onReplyToAnchor = useCallback(() => {
|
||||
const onReplyToAnchor = useNonReactiveCallback(() => {
|
||||
if (anchor?.type !== 'threadPost') {
|
||||
return
|
||||
}
|
||||
@@ -143,13 +143,7 @@ export function PostThread({uri}: {uri: string}) {
|
||||
reqId: anchorPostSource.post.reqId,
|
||||
})
|
||||
}
|
||||
}, [
|
||||
anchor,
|
||||
openComposer,
|
||||
optimisticOnPostReply,
|
||||
anchorPostSource,
|
||||
feedFeedback,
|
||||
])
|
||||
})
|
||||
|
||||
const isRoot = !!anchor && anchor.value.post.record.reply === undefined
|
||||
const canReply = !anchor?.value.post?.viewer?.replyDisabled
|
||||
|
||||
Reference in New Issue
Block a user