ENHANCEEEECEE

This commit is contained in:
Eric Bailey
2025-06-10 18:17:47 -05:00
parent 244bb13715
commit 568a5d4ee5
2 changed files with 10 additions and 13 deletions
+8 -10
View File
@@ -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)
}
/**
+2 -3
View File
@@ -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,