From 237440f2ec0468e3f5ca4baff798d240243fe5e7 Mon Sep 17 00:00:00 2001 From: diondiondion Date: Wed, 25 Mar 2026 11:24:19 +0100 Subject: [PATCH] [Glitch] Hide empty state of topic suggestions dropdown in Collection editor Port bafc552a722fc6875c9adc845fd32ba031e58f66 to glitch-soc Signed-off-by: Claire --- .../features/collections/editor/details.tsx | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/app/javascript/flavours/glitch/features/collections/editor/details.tsx b/app/javascript/flavours/glitch/features/collections/editor/details.tsx index 6cbce6531d..fd9a08f38b 100644 --- a/app/javascript/flavours/glitch/features/collections/editor/details.tsx +++ b/app/javascript/flavours/glitch/features/collections/editor/details.tsx @@ -1,4 +1,4 @@ -import { Fragment, useCallback, useMemo, useState } from 'react'; +import { Fragment, useCallback, useMemo } from 'react'; import { FormattedMessage, useIntl } from 'react-intl'; @@ -10,7 +10,6 @@ import { languages } from '@/flavours/glitch/initial_state'; import { hasSpecialCharacters, inputToHashtag, - trimHashFromStart, } from '@/flavours/glitch/utils/hashtags'; import type { ApiCreateCollectionPayload, @@ -297,14 +296,7 @@ export const CollectionDetails: React.FC = () => { const TopicField: React.FC = () => { const intl = useIntl(); const dispatch = useAppDispatch(); - const { id, topic } = useAppSelector((state) => state.collections.editor); - - const collection = useAppSelector((state) => - id ? state.collections.collections[id] : undefined, - ); - const [isInitialValue, setIsInitialValue] = useState( - () => trimHashFromStart(topic) === (collection?.tag?.name ?? ''), - ); + const { topic } = useAppSelector((state) => state.collections.editor); const { tags, isLoading, searchTags } = useSearchTags({ query: topic, @@ -312,7 +304,6 @@ const TopicField: React.FC = () => { const handleTopicChange = useCallback( (event: React.ChangeEvent) => { - setIsInitialValue(false); dispatch( updateCollectionEditorField({ field: 'topic', @@ -379,7 +370,7 @@ const TopicField: React.FC = () => { } : undefined } - suppressMenu={isInitialValue} + suppressMenu={!tags.length} /> ); };