Skip to content

Commit

Permalink
fix(states): non chainproviders clients are showing as 'resolving-add…
Browse files Browse the repository at this point in the history
…ress' state
  • Loading branch information
estebanabaroa committed Jun 1, 2024
1 parent 5505395 commit edc5d85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/hooks/states.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,19 @@ 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)
}
}
}
} 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)
}
}
Expand Down

0 comments on commit edc5d85

Please sign in to comment.