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