Revert "Instant Feed Update on Mute or Moderation Action" (#8482)

This commit is contained in:
Samuel Newman
2025-06-12 23:16:52 +03:00
committed by GitHub
parent 8a5a7db146
commit 18b4fcf8eb
2 changed files with 3 additions and 13 deletions
+2 -10
View File
@@ -15,7 +15,6 @@ import {findAllPostsInQueryData as findAllPostsInQuoteQueryData} from '#/state/q
import {findAllPostsInQueryData as findAllPostsInThreadQueryData} from '#/state/queries/post-thread' import {findAllPostsInQueryData as findAllPostsInThreadQueryData} from '#/state/queries/post-thread'
import {findAllPostsInQueryData as findAllPostsInSearchQueryData} from '#/state/queries/search-posts' import {findAllPostsInQueryData as findAllPostsInSearchQueryData} from '#/state/queries/search-posts'
import {findAllPostsInQueryData as findAllPostsInThreadV2QueryData} from '#/state/queries/usePostThread/queryCache' import {findAllPostsInQueryData as findAllPostsInThreadV2QueryData} from '#/state/queries/usePostThread/queryCache'
import {useProfileShadow} from './profile-shadow'
import {castAsShadow, type Shadow} from './types' import {castAsShadow, type Shadow} from './types'
export type {Shadow} from './types' export type {Shadow} from './types'
@@ -45,10 +44,6 @@ export function usePostShadow(
setShadow(shadows.get(post)) setShadow(shadows.get(post))
} }
const authorShadow = useProfileShadow(post.author)
const wasMuted = !!authorShadow.viewer?.muted
const wasBlocked = !!authorShadow.viewer?.blocking
useEffect(() => { useEffect(() => {
function onUpdate() { function onUpdate() {
setShadow(shadows.get(post)) setShadow(shadows.get(post))
@@ -60,18 +55,15 @@ export function usePostShadow(
}, [post, setShadow]) }, [post, setShadow])
return useMemo(() => { return useMemo(() => {
if (wasMuted || wasBlocked) {
return POST_TOMBSTONE
}
if (shadow) { if (shadow) {
return mergeShadow(post, shadow) return mergeShadow(post, shadow)
} else { } else {
return castAsShadow(post) return castAsShadow(post)
} }
}, [post, shadow, wasMuted, wasBlocked]) }, [post, shadow])
} }
export function mergeShadow( function mergeShadow(
post: AppBskyFeedDefs.PostView, post: AppBskyFeedDefs.PostView,
shadow: Partial<PostShadow>, shadow: Partial<PostShadow>,
): Shadow<AppBskyFeedDefs.PostView> | typeof POST_TOMBSTONE { ): Shadow<AppBskyFeedDefs.PostView> | typeof POST_TOMBSTONE {
+1 -3
View File
@@ -499,10 +499,9 @@ function useProfileBlockMutation() {
{subject: did, createdAt: new Date().toISOString()}, {subject: did, createdAt: new Date().toISOString()},
) )
}, },
onSuccess(data, {did}) { onSuccess(_, {did}) {
queryClient.invalidateQueries({queryKey: RQKEY_MY_BLOCKED()}) queryClient.invalidateQueries({queryKey: RQKEY_MY_BLOCKED()})
resetProfilePostsQueries(queryClient, did, 1000) resetProfilePostsQueries(queryClient, did, 1000)
updateProfileShadow(queryClient, did, {blockingUri: data.uri})
}, },
}) })
} }
@@ -524,7 +523,6 @@ function useProfileUnblockMutation() {
}, },
onSuccess(_, {did}) { onSuccess(_, {did}) {
resetProfilePostsQueries(queryClient, did, 1000) resetProfilePostsQueries(queryClient, did, 1000)
updateProfileShadow(queryClient, did, {blockingUri: undefined})
}, },
}) })
} }