From c661e9017d6939149bde0987e5246fc3e2ecd8e7 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 27 May 2020 19:49:58 +0200 Subject: [PATCH] Don't display era on ForceNone (#2837) --- packages/page-explorer/src/SummarySession.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/page-explorer/src/SummarySession.tsx b/packages/page-explorer/src/SummarySession.tsx index 359a1dbd71..99bd35c94d 100644 --- a/packages/page-explorer/src/SummarySession.tsx +++ b/packages/page-explorer/src/SummarySession.tsx @@ -3,6 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { DeriveSessionProgress } from '@polkadot/api-derive/types'; +import { Forcing } from '@polkadot/types/interfaces'; import React, { useMemo } from 'react'; import { CardSummary } from '@polkadot/react-components'; @@ -20,6 +21,9 @@ function SummarySession ({ withEra = true, withSession = true }: Props): React.R const { t } = useTranslation(); const { api } = useApi(); const sessionInfo = useCall(api.derive.session?.progress, []); + const isForceNone = useCall(api.query.staking?.forceEra, [], { + transform: (forcing: Forcing) => forcing.isForceNone + }); const eraLabel = useMemo(() => t('era') , [t]); @@ -51,7 +55,7 @@ function SummarySession ({ withEra = true, withSession = true }: Props): React.R ) )} - {withEra && ( + {!isForceNone && withEra && ( sessionInfo.sessionLength.gtn(1) ? (