From d7b5ea9b9ead53193204af99374ced2465a83e4e Mon Sep 17 00:00:00 2001 From: daniyal Date: Wed, 21 Aug 2024 12:53:19 +0500 Subject: [PATCH] fix: use default relayMap if its undefined in redux store --- src/utils/nostr.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/nostr.ts b/src/utils/nostr.ts index f3d6736..9bade2f 100644 --- a/src/utils/nostr.ts +++ b/src/utils/nostr.ts @@ -33,6 +33,7 @@ import { Meta, SignedEvent, UserAppData } from '../types' import { getHash } from './hash' import { parseJson, removeLeadingSlash } from './string' import { timeout } from './utils' +import { getDefaultRelayMap } from './relays' /** * @param hexKey hex private or public key @@ -598,7 +599,8 @@ export const updateUsersAppData = async (meta: Meta) => { if (!signedEvent) return null - const relayMap = (store.getState().relays as RelaysState).map! + const relayMap = + (store.getState().relays as RelaysState).map || getDefaultRelayMap() const writeRelays = Object.keys(relayMap).filter((key) => relayMap[key].write) const publishResult = await Promise.race([