130-fix-empty-relay-issue #131
@ -44,6 +44,7 @@ import {
|
|||||||
getNsecBunkerDelegatedKey,
|
getNsecBunkerDelegatedKey,
|
||||||
verifySignedEvent
|
verifySignedEvent
|
||||||
} from '../utils'
|
} from '../utils'
|
||||||
|
import { getDefaultRelayMap } from '../utils/relays.ts'
|
||||||
|
|
||||||
export class NostrController extends EventEmitter {
|
export class NostrController extends EventEmitter {
|
||||||
private static instance: NostrController
|
private static instance: NostrController
|
||||||
@ -650,7 +651,7 @@ export class NostrController extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
getRelayMap = async (
|
getRelayMap = async (
|
||||||
npub: string
|
npub: string
|
||||||
): Promise<{ map: RelayMap; mapUpdated: number }> => {
|
): Promise<{ map: RelayMap; mapUpdated?: number }> => {
|
||||||
const mostPopularRelays = await this.getMostPopularRelays()
|
const mostPopularRelays = await this.getMostPopularRelays()
|
||||||
|
|
||||||
const pool = new SimplePool()
|
const pool = new SimplePool()
|
||||||
@ -691,7 +692,7 @@ export class NostrController extends EventEmitter {
|
|||||||
|
|
||||||
return Promise.resolve({ map: relaysMap, mapUpdated: event.created_at })
|
return Promise.resolve({ map: relaysMap, mapUpdated: event.created_at })
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject('User relays were not found.')
|
return Promise.resolve({ map: getDefaultRelayMap() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ export const RelaysPage = () => {
|
|||||||
if (isMounted) {
|
if (isMounted) {
|
||||||
if (
|
if (
|
||||||
!relaysState?.mapUpdated ||
|
!relaysState?.mapUpdated ||
|
||||||
newRelayMap.mapUpdated > relaysState?.mapUpdated
|
newRelayMap?.mapUpdated !== undefined && (newRelayMap?.mapUpdated > relaysState?.mapUpdated)
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
!relaysState?.map ||
|
!relaysState?.map ||
|
||||||
|
Loading…
Reference in New Issue
Block a user