diff --git a/ts/components/StoriesSettingsModal.tsx b/ts/components/StoriesSettingsModal.tsx index e53e064d004b..7deed0358256 100644 --- a/ts/components/StoriesSettingsModal.tsx +++ b/ts/components/StoriesSettingsModal.tsx @@ -67,6 +67,17 @@ enum Page { HideStoryFrom = 'HideStoryFrom', } +function filterConversations( + conversations: ReadonlyArray, + searchTerm: string +) { + return filterAndSortConversationsByRecent( + conversations, + searchTerm, + undefined + ).filter(conversation => conversation.uuid); +} + export const StoriesSettingsModal = ({ candidateConversations, distributionLists, @@ -99,11 +110,7 @@ export const StoriesSettingsModal = ({ const [searchTerm, setSearchTerm] = useState(''); const [filteredConversations, setFilteredConversations] = useState( - filterAndSortConversationsByRecent( - candidateConversations, - searchTerm, - undefined - ) + filterConversations(candidateConversations, searchTerm) ); const [selectedContacts, setSelectedContacts] = useState< @@ -145,11 +152,7 @@ export const StoriesSettingsModal = ({ useEffect(() => { const timeout = setTimeout(() => { setFilteredConversations( - filterAndSortConversationsByRecent( - candidateConversations, - normalizedSearchTerm, - undefined - ) + filterConversations(candidateConversations, normalizedSearchTerm) ); }, 200); return () => {