ENHANCEEEECEE
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {useCallback, useId, useState} from 'react'
|
||||
import {useId, useState} from 'react'
|
||||
import {type AppBskyFeedDefs, AtUri} from '@atproto/api'
|
||||
|
||||
import {Logger} from '#/logger'
|
||||
@@ -33,15 +33,13 @@ const consumedSourcesRef = new Map<string, PostSource>()
|
||||
*
|
||||
* Used for FeedFeedback and other ephemeral non-critical systems.
|
||||
*/
|
||||
export function useSetUnstablePostSource() {
|
||||
return useCallback((key: string, source: PostSource) => {
|
||||
assertValid(
|
||||
key,
|
||||
`setUnstablePostSource key should be a URI containing a handle, received ${key} — use buildPostSourceKey`,
|
||||
)
|
||||
logger.debug('set', {key, source})
|
||||
transientSourcesRef.set(key, source)
|
||||
}, [])
|
||||
export function setUnstablePostSource(key: string, source: PostSource) {
|
||||
assertValid(
|
||||
key,
|
||||
`setUnstablePostSource key should be a URI containing a handle, received ${key} — use buildPostSourceKey`,
|
||||
)
|
||||
logger.debug('set', {key, source})
|
||||
transientSourcesRef.set(key, source)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ import {useSession} from '#/state/session'
|
||||
import {useMergedThreadgateHiddenReplies} from '#/state/threadgate-hidden-replies'
|
||||
import {
|
||||
buildPostSourceKey,
|
||||
useSetUnstablePostSource,
|
||||
setUnstablePostSource,
|
||||
} from '#/state/unstable-post-source'
|
||||
import {FeedNameText} from '#/view/com/util/FeedInfoText'
|
||||
import {Link, TextLink, TextLinkOnWebOnly} from '#/view/com/util/Link'
|
||||
@@ -179,7 +179,6 @@ let FeedItemInner = ({
|
||||
return makeProfileLink(post.author, 'post', urip.rkey)
|
||||
}, [post.uri, post.author])
|
||||
const {sendInteraction, feedDescriptor} = useFeedFeedbackContext()
|
||||
const unstableSetPostSource = useSetUnstablePostSource()
|
||||
|
||||
const onPressReply = () => {
|
||||
sendInteraction({
|
||||
@@ -235,7 +234,7 @@ let FeedItemInner = ({
|
||||
reqId,
|
||||
})
|
||||
unstableCacheProfileView(queryClient, post.author)
|
||||
unstableSetPostSource(buildPostSourceKey(post.uri, post.author.handle), {
|
||||
setUnstablePostSource(buildPostSourceKey(post.uri, post.author.handle), {
|
||||
feed: feedDescriptor,
|
||||
post: {
|
||||
post,
|
||||
|
||||
Reference in New Issue
Block a user