From 471447180c1081016e7a9f3307d92d45d85a4001 Mon Sep 17 00:00:00 2001 From: Jaco Date: Tue, 26 Apr 2022 09:35:45 +0200 Subject: [PATCH] Cater for non-standard nominee maps (#7450) --- packages/page-staking/src/Actions/Account/ListNominees.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/page-staking/src/Actions/Account/ListNominees.tsx b/packages/page-staking/src/Actions/Account/ListNominees.tsx index d2aefb7bd9..1427b081d2 100644 --- a/packages/page-staking/src/Actions/Account/ListNominees.tsx +++ b/packages/page-staking/src/Actions/Account/ListNominees.tsx @@ -8,7 +8,7 @@ import React, { useMemo } from 'react'; import { AddressMini, ExpanderScroll, MarkWarning } from '@polkadot/react-components'; import { useApi, useCall } from '@polkadot/react-hooks'; -import { isFunction } from '@polkadot/util'; +import { isFunction, isToBn } from '@polkadot/util'; import { useTranslation } from '../../translate'; import useInactives from '../useInactives'; @@ -31,7 +31,8 @@ function mapExposure (stashId: string, all: string[], eraExposure?: DeriveEraExp all.forEach((nom) => { // cycle through its nominator to find our current stash eraExposure.validators[nom]?.others.some((o) => { - if (o.who.eq(stashId)) { + // NOTE Some chains have non-standard implementations, without value + if (o.who.eq(stashId) && isToBn(o.value)) { nomBalanceMap[nom] = o.value.toBn(); return true; @@ -56,7 +57,7 @@ function renderNominators (stashId: string, all: string[] = [], eraExposure?: De balance={nomBalanceMap[nomineeId]} key={index} value={nomineeId} - withBalance={!!eraExposure} + withBalance={!!eraExposure && !!nomBalanceMap[nomineeId]} /> )); }