From e0d6c0363951c66bdede17759ae712626a4a07a5 Mon Sep 17 00:00:00 2001 From: enes Date: Tue, 20 Aug 2024 13:52:24 +0200 Subject: [PATCH] fix(relay-controller): sigit relay immutability and relay list --- src/controllers/RelayController.ts | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/controllers/RelayController.ts b/src/controllers/RelayController.ts index 12f24c2..83d8ab3 100644 --- a/src/controllers/RelayController.ts +++ b/src/controllers/RelayController.ts @@ -86,11 +86,8 @@ export class RelayController { filter: Filter, relayUrls: string[] = [] ): Promise => { - // add app relay to relays array - relayUrls.push(SIGIT_RELAY) - - // Connect to all specified relays - const relayPromises = relayUrls.map((relayUrl) => + // Add app relay to relays array and connect to all specified relays + const relayPromises = [...relayUrls, SIGIT_RELAY].map((relayUrl) => this.connectRelay(relayUrl) ) @@ -204,11 +201,9 @@ export class RelayController { relayUrls: string[] = [], eventHandler: (event: Event) => void ) => { - // add app relay to relays array - relayUrls.push(SIGIT_RELAY) + // Add app relay to relays array and connect to all specified relays - // Connect to all specified relays - const relayPromises = relayUrls.map((relayUrl) => + const relayPromises = [...relayUrls, SIGIT_RELAY].map((relayUrl) => this.connectRelay(relayUrl) ) @@ -263,11 +258,9 @@ export class RelayController { event: Event, relayUrls: string[] = [] ): Promise => { - // add app relay to relays array - relayUrls.push(SIGIT_RELAY) + // Add app relay to relays array and connect to all specified relays - // Connect to all specified relays - const relayPromises = relayUrls.map((relayUrl) => + const relayPromises = [...relayUrls, SIGIT_RELAY].map((relayUrl) => this.connectRelay(relayUrl) )