From edc5d85713f63281f0d1aaecabf89c8e35589046 Mon Sep 17 00:00:00 2001 From: Esteban Abaroa Date: Tue, 21 May 2024 18:28:41 +0000 Subject: [PATCH] fix(states): non chainproviders clients are showing as 'resolving-address' state --- src/hooks/states.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hooks/states.ts b/src/hooks/states.ts index dd65dce5..28c7f109 100644 --- a/src/hooks/states.ts +++ b/src/hooks/states.ts @@ -145,7 +145,9 @@ export function useSubplebbitsStates(options?: UseSubplebbitsStatesOptions): Use for (const chainTicker in subplebbit.clients.chainProviders) { for (const clientUrl in subplebbit.clients.chainProviders[chainTicker]) { const state = subplebbit.clients.chainProviders[chainTicker][clientUrl].state - if (state !== 'stopped') { + // match 'resolving' in case plebbit-js has clients with incorrect states + // TODO: this should in theory never happen, but it does, and difficult to debug + if (state !== 'stopped' && state?.startsWith('resolving')) { states[subplebbit.updatingState].clientUrls.add(clientUrl) } } @@ -153,7 +155,9 @@ export function useSubplebbitsStates(options?: UseSubplebbitsStatesOptions): Use } else { for (const clientUrl in subplebbit.clients[clientType]) { const state = subplebbit.clients[clientType][clientUrl].state - if (state !== 'stopped') { + // match 'resolving' in case plebbit-js has clients with incorrect states + // TODO: this should in theory never happen, but it does, and difficult to debug + if (state !== 'stopped' && state?.startsWith('resolving') === false) { states[subplebbit.updatingState].clientUrls.add(clientUrl) } }