diff --git a/src/contexts/Pools/ActivePool/index.tsx b/src/contexts/Pools/ActivePool/index.tsx index 8d53be1364..4a7183fce6 100644 --- a/src/contexts/Pools/ActivePool/index.tsx +++ b/src/contexts/Pools/ActivePool/index.tsx @@ -111,6 +111,7 @@ export const ActivePoolProvider = ({ children }: { children: ReactNode }) => { // Membership takes priority, followed by the first pool the account has a role in. Falls back // to `null` if no active roles are found. const initialActivePoolId = membership?.poolId || accountPoolIds[0] || null; + if (initialActivePoolId && !activePool) { setActivePoolId(String(initialActivePoolId)); } @@ -227,6 +228,7 @@ export const ActivePoolProvider = ({ children }: { children: ReactNode }) => { assignActivePoolId(); } }, [network, isReady, accountPoolIds]); + console.log('accountPoolIds: ', accountPoolIds); // Reset on network change and component unmount. NOTE: ActivePoolsController also unsubscribes on // network change; this is handled by the Api instance. diff --git a/src/controllers/ActivePoolsController/index.ts b/src/controllers/ActivePoolsController/index.ts index edba024102..78fc5b96f3 100644 --- a/src/controllers/ActivePoolsController/index.ts +++ b/src/controllers/ActivePoolsController/index.ts @@ -122,7 +122,9 @@ export class ActivePoolsController { accountDataResult: AnyApi ): Promise => { const bondedPool = bondedPoolResult?.unwrapOr(undefined)?.toHuman(); + console.log('bondedPool: ', bondedPool); const rewardPool = rewardPoolResult?.unwrapOr(undefined)?.toHuman(); + console.log('rewardPool: ', rewardPool); const balance = accountDataResult.data; const rewardAccountBalance = balance?.free.toString(); diff --git a/src/controllers/IdentitiesController/index.ts b/src/controllers/IdentitiesController/index.ts index a7cdc450fa..5ff8d50558 100644 --- a/src/controllers/IdentitiesController/index.ts +++ b/src/controllers/IdentitiesController/index.ts @@ -3,7 +3,6 @@ import type { AnyApi } from 'types'; import type { ApiPromise } from '@polkadot/api'; -import type { AnyJson } from '@w3ux/types'; export class IdentitiesController { static fetch = async (api: ApiPromise, addresses: string[]) => { @@ -13,15 +12,19 @@ export class IdentitiesController { (identity) => identity.toHuman() ); + // REVERTING #2090 + // Take identity data (first index) of results. - const data = result.map( - (resultArray: AnyJson | null) => resultArray?.[0] || null - ); + // const data = result.map( + // (resultArray: AnyJson | null) => resultArray?.[0] || null + // ); return Object.fromEntries( - data - .map((key: string, index: number) => [addresses[index], key]) - .filter(([, value]) => value !== null) + // data + // .map((key: string, index: number) => [addresses[index], key]) + // .filter(([, value]) => value !== null) + + result.map((k, i) => [addresses[i], k]).filter(([, v]) => v !== null) ); }; @@ -49,16 +52,17 @@ export class IdentitiesController { ).map((superIdentity) => superIdentity.toHuman()); // Take identity data (first index) of results. - const data = superIdentities.map( - (resultArray: AnyJson | null) => resultArray?.[0] || null - ); + // const data = superIdentities.map( + // (resultArray: AnyJson | null) => resultArray?.[0] || null + // ); const supersWithIdentity = Object.fromEntries( Object.entries(supers).map(([k, v]: AnyApi, i) => [ k, { ...v, - identity: data[i], + // identity: data[i], + identity: superIdentities[i], }, ]) ); diff --git a/src/hooks/useActivePools/index.tsx b/src/hooks/useActivePools/index.tsx index 4ba1508847..506b7ab535 100644 --- a/src/hooks/useActivePools/index.tsx +++ b/src/hooks/useActivePools/index.tsx @@ -60,6 +60,10 @@ export const useActivePools = ({ onCallback, who }: ActivePoolsProps) => { // Get an active pool. const getActivePools = (poolId: string) => activePools?.[poolId] || null; + useEffect(() => { + console.log('activePools: ', activePools); + }, [activePools]); + // Get an active pool's nominations. const getPoolNominations = (poolId: string) => poolNominations?.[poolId] || null;