130-fix-empty-relay-issue #131

Merged
eugene merged 7 commits from 130-fix-empty-relay-issue into staging 2024-08-07 15:27:20 +00:00
2 changed files with 4 additions and 3 deletions
Showing only changes of commit 2355da02d2 - Show all commits

View File

@ -44,6 +44,7 @@ import {
getNsecBunkerDelegatedKey,
verifySignedEvent
} from '../utils'
import { getDefaultRelayMap } from '../utils/relays.ts'
export class NostrController extends EventEmitter {
private static instance: NostrController
@ -650,7 +651,7 @@ export class NostrController extends EventEmitter {
*/
getRelayMap = async (
npub: string
): Promise<{ map: RelayMap; mapUpdated: number }> => {
): Promise<{ map: RelayMap; mapUpdated?: number }> => {
const mostPopularRelays = await this.getMostPopularRelays()
const pool = new SimplePool()
@ -691,7 +692,7 @@ export class NostrController extends EventEmitter {
return Promise.resolve({ map: relaysMap, mapUpdated: event.created_at })
} else {
return Promise.reject('User relays were not found.')
return Promise.resolve({ map: getDefaultRelayMap() })
}
}

View File

@ -91,7 +91,7 @@ export const RelaysPage = () => {
if (isMounted) {
if (
!relaysState?.mapUpdated ||
newRelayMap.mapUpdated > relaysState?.mapUpdated
newRelayMap?.mapUpdated !== undefined && (newRelayMap?.mapUpdated > relaysState?.mapUpdated)
) {
if (
!relaysState?.map ||