From 35f9ed82b9e23f149b847df96fe7cf04bd3b0b40 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 20 Feb 2026 17:29:08 +0000 Subject: [PATCH] Fix string concat bug with trending topics muteword moderation (#9914) --- src/state/queries/trending/useTrendingTopics.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/state/queries/trending/useTrendingTopics.ts b/src/state/queries/trending/useTrendingTopics.ts index 9cacfd1663..81b25e5f94 100644 --- a/src/state/queries/trending/useTrendingTopics.ts +++ b/src/state/queries/trending/useTrendingTopics.ts @@ -1,4 +1,4 @@ -import React from 'react' +import {useCallback, useMemo} from 'react' import {type AppBskyUnspeccedDefs, hasMutedWord} from '@atproto/api' import {useQuery} from '@tanstack/react-query' @@ -29,7 +29,7 @@ export const trendingTopicsQueryKey = ['trending-topics'] export function useTrendingTopics() { const agent = useAgent() const {data: preferences} = usePreferencesQuery() - const mutedWords = React.useMemo( + const mutedWords = useMemo( () => preferences?.moderationPrefs?.mutedWords ?? [], [preferences?.moderationPrefs?.mutedWords], ) @@ -39,7 +39,7 @@ export function useTrendingTopics() { staleTime: STALE.MINUTES.THREE, queryKey: trendingTopicsQueryKey, async queryFn() { - const {data} = await agent.api.app.bsky.unspecced.getTrendingTopics({ + const {data} = await agent.app.bsky.unspecced.getTrendingTopics({ limit: DEFAULT_LIMIT, }) return { @@ -47,14 +47,14 @@ export function useTrendingTopics() { suggested: data.suggested ?? [], } }, - select: React.useCallback( + select: useCallback( (data: Response) => { return { topics: dedup( data.topics.filter(t => { return !hasMutedWord({ mutedWords, - text: t.topic + ' ' + t.displayName + ' ' + t.description, + text: `${t.topic} ${t.displayName ?? ''} ${t.description ?? ''}`, }) }), ), @@ -62,7 +62,7 @@ export function useTrendingTopics() { data.suggested.filter(t => { return !hasMutedWord({ mutedWords, - text: t.topic + ' ' + t.displayName + ' ' + t.description, + text: `${t.topic} ${t.displayName ?? ''} ${t.description ?? ''}`, }) }), ),