fix(ndk): dont create NDKRelaySet from empty arrays
All checks were successful
Release to Staging / build_and_release (push) Successful in 49s
All checks were successful
Release to Staging / build_and_release (push) Successful in 49s
This commit is contained in:
parent
994382f39c
commit
8d20678c75
@ -245,7 +245,7 @@ export const NDKContextProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
// Find the user's relays (10s timeout).
|
// Find the user's relays (10s timeout).
|
||||||
const relayUrls = await Promise.race([
|
const relayUrls = await Promise.race([
|
||||||
getRelayListForUser(hexKey, ndk),
|
getRelayListForUser(hexKey, ndk),
|
||||||
timeout(10000)
|
timeout(3000)
|
||||||
])
|
])
|
||||||
.then((ndkRelayList) => {
|
.then((ndkRelayList) => {
|
||||||
if (ndkRelayList) return ndkRelayList[userRelaysType]
|
if (ndkRelayList) return ndkRelayList[userRelaysType]
|
||||||
@ -265,7 +265,9 @@ export const NDKContextProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
.fetchEvents(
|
.fetchEvents(
|
||||||
filter,
|
filter,
|
||||||
{ closeOnEose: true, cacheUsage: NDKSubscriptionCacheUsage.PARALLEL },
|
{ closeOnEose: true, cacheUsage: NDKSubscriptionCacheUsage.PARALLEL },
|
||||||
NDKRelaySet.fromRelayUrls(relayUrls, ndk, true)
|
relayUrls.length
|
||||||
|
? NDKRelaySet.fromRelayUrls(relayUrls, ndk, true)
|
||||||
|
: undefined
|
||||||
)
|
)
|
||||||
.then((ndkEventSet) => {
|
.then((ndkEventSet) => {
|
||||||
const ndkEvents = Array.from(ndkEventSet)
|
const ndkEvents = Array.from(ndkEventSet)
|
||||||
|
@ -66,7 +66,9 @@ export const useComments = (
|
|||||||
closeOnEose: false,
|
closeOnEose: false,
|
||||||
cacheUsage: NDKSubscriptionCacheUsage.CACHE_FIRST
|
cacheUsage: NDKSubscriptionCacheUsage.CACHE_FIRST
|
||||||
},
|
},
|
||||||
NDKRelaySet.fromRelayUrls(Array.from(relayUrls), ndk)
|
relayUrls.size
|
||||||
|
? NDKRelaySet.fromRelayUrls(Array.from(relayUrls), ndk)
|
||||||
|
: undefined
|
||||||
)
|
)
|
||||||
|
|
||||||
subscription.on('event', (ndkEvent) => {
|
subscription.on('event', (ndkEvent) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user