From 568a5d4ee5c024aad12a03a71429c8ef5cc5b3ff Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 10 Jun 2025 18:17:47 -0500 Subject: [PATCH] ENHANCEEEECEE --- src/state/unstable-post-source.tsx | 18 ++++++++---------- src/view/com/posts/PostFeedItem.tsx | 5 ++--- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/state/unstable-post-source.tsx b/src/state/unstable-post-source.tsx index 3a63904cdf..c2861fbe15 100644 --- a/src/state/unstable-post-source.tsx +++ b/src/state/unstable-post-source.tsx @@ -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() * * 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) } /** diff --git a/src/view/com/posts/PostFeedItem.tsx b/src/view/com/posts/PostFeedItem.tsx index a466cc1567..fd0d1c707d 100644 --- a/src/view/com/posts/PostFeedItem.tsx +++ b/src/view/com/posts/PostFeedItem.tsx @@ -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,