diff --git a/src/hooks/useSearchProfiles.tsx b/src/hooks/useSearchProfiles.tsx index 5a5cc1c7..50b41afa 100644 --- a/src/hooks/useSearchProfiles.tsx +++ b/src/hooks/useSearchProfiles.tsx @@ -1,3 +1,4 @@ +import { SEARCHABLE_RELAY_URLS } from '@/constants' import { useFeed } from '@/providers/FeedProvider' import client from '@/services/client.service' import { TProfile } from '@/types' @@ -13,19 +14,21 @@ export function useSearchProfiles(search: string, limit: number) { useEffect(() => { const fetchProfiles = async () => { - if (!search) return + if (!search) { + setProfiles([]) + return + } setIsFetching(true) setProfiles([]) - if (searchableRelayUrls.length === 0) { - setIsFetching(false) - return - } try { - const profiles = await client.fetchProfiles(searchableRelayUrls, { - search, - limit - }) + const profiles = await client.fetchProfiles( + searchableRelayUrls.length > 0 ? searchableRelayUrls : SEARCHABLE_RELAY_URLS, + { + search, + limit + } + ) if (profiles) { setProfiles(profiles) }