From 18b4fcf8eb1ec4d27c1245726a4dbf50c534f651 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Thu, 12 Jun 2025 23:16:52 +0300 Subject: Revert "Instant Feed Update on Mute or Moderation Action" (#8482) --- src/state/cache/post-shadow.ts | 12 ++---------- src/state/queries/profile.ts | 4 +--- 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/state/cache/post-shadow.ts b/src/state/cache/post-shadow.ts index 90fddda2b..d7f1eb8b9 100644 --- a/src/state/cache/post-shadow.ts +++ b/src/state/cache/post-shadow.ts @@ -15,7 +15,6 @@ import {findAllPostsInQueryData as findAllPostsInQuoteQueryData} from '#/state/q import {findAllPostsInQueryData as findAllPostsInThreadQueryData} from '#/state/queries/post-thread' import {findAllPostsInQueryData as findAllPostsInSearchQueryData} from '#/state/queries/search-posts' import {findAllPostsInQueryData as findAllPostsInThreadV2QueryData} from '#/state/queries/usePostThread/queryCache' -import {useProfileShadow} from './profile-shadow' import {castAsShadow, type Shadow} from './types' export type {Shadow} from './types' @@ -45,10 +44,6 @@ export function usePostShadow( setShadow(shadows.get(post)) } - const authorShadow = useProfileShadow(post.author) - const wasMuted = !!authorShadow.viewer?.muted - const wasBlocked = !!authorShadow.viewer?.blocking - useEffect(() => { function onUpdate() { setShadow(shadows.get(post)) @@ -60,18 +55,15 @@ export function usePostShadow( }, [post, setShadow]) return useMemo(() => { - if (wasMuted || wasBlocked) { - return POST_TOMBSTONE - } if (shadow) { return mergeShadow(post, shadow) } else { return castAsShadow(post) } - }, [post, shadow, wasMuted, wasBlocked]) + }, [post, shadow]) } -export function mergeShadow( +function mergeShadow( post: AppBskyFeedDefs.PostView, shadow: Partial, ): Shadow | typeof POST_TOMBSTONE { diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index b0af57c4a..eb65fef7c 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -499,10 +499,9 @@ function useProfileBlockMutation() { {subject: did, createdAt: new Date().toISOString()}, ) }, - onSuccess(data, {did}) { + onSuccess(_, {did}) { queryClient.invalidateQueries({queryKey: RQKEY_MY_BLOCKED()}) resetProfilePostsQueries(queryClient, did, 1000) - updateProfileShadow(queryClient, did, {blockingUri: data.uri}) }, }) } @@ -524,7 +523,6 @@ function useProfileUnblockMutation() { }, onSuccess(_, {did}) { resetProfilePostsQueries(queryClient, did, 1000) - updateProfileShadow(queryClient, did, {blockingUri: undefined}) }, }) } -- cgit 1.4.1