From dae923ee38b0008d84dd26e3695ecdf8dc450891 Mon Sep 17 00:00:00 2001 From: codytseng Date: Tue, 21 Jan 2025 14:49:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useSearchProfiles.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) 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) }