fix: 🐛
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { SEARCHABLE_RELAY_URLS } from '@/constants'
|
||||||
import { useFeed } from '@/providers/FeedProvider'
|
import { useFeed } from '@/providers/FeedProvider'
|
||||||
import client from '@/services/client.service'
|
import client from '@/services/client.service'
|
||||||
import { TProfile } from '@/types'
|
import { TProfile } from '@/types'
|
||||||
@@ -13,19 +14,21 @@ export function useSearchProfiles(search: string, limit: number) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchProfiles = async () => {
|
const fetchProfiles = async () => {
|
||||||
if (!search) return
|
if (!search) {
|
||||||
|
setProfiles([])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
setIsFetching(true)
|
setIsFetching(true)
|
||||||
setProfiles([])
|
setProfiles([])
|
||||||
if (searchableRelayUrls.length === 0) {
|
|
||||||
setIsFetching(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const profiles = await client.fetchProfiles(searchableRelayUrls, {
|
const profiles = await client.fetchProfiles(
|
||||||
|
searchableRelayUrls.length > 0 ? searchableRelayUrls : SEARCHABLE_RELAY_URLS,
|
||||||
|
{
|
||||||
search,
|
search,
|
||||||
limit
|
limit
|
||||||
})
|
}
|
||||||
|
)
|
||||||
if (profiles) {
|
if (profiles) {
|
||||||
setProfiles(profiles)
|
setProfiles(profiles)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user