From 14f84608dd6ac2afd1a7ff67f147531e352c6aef Mon Sep 17 00:00:00 2001 From: Dexter Date: Wed, 25 May 2022 09:41:04 +0100 Subject: [PATCH] Revert "fix: make error handling consistent for useTranches" This reverts commit 357cbc45f8fbc67c992160aa18dc847124ca4a26. --- apps/token/src/routes/claim/index.tsx | 14 +++------- .../home/token-details/token-details.tsx | 27 ++----------------- .../src/routes/redemption/redemption.tsx | 4 +-- apps/token/src/routes/tranches/index.tsx | 14 +++------- 4 files changed, 10 insertions(+), 49 deletions(-) diff --git a/apps/token/src/routes/claim/index.tsx b/apps/token/src/routes/claim/index.tsx index 0dbbe5f3b..131029104 100644 --- a/apps/token/src/routes/claim/index.tsx +++ b/apps/token/src/routes/claim/index.tsx @@ -10,15 +10,15 @@ import type { RouteChildProps } from '..'; import Claim from './claim'; import { ClaimRestricted } from './claim-restricted'; import { isRestricted } from './lib/is-restricted'; -import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit'; +import { Splash } from '@vegaprotocol/ui-toolkit'; const ClaimIndex = ({ name }: RouteChildProps) => { useDocumentTitle(name); const { t } = useTranslation(); const { account } = useWeb3React(); - const { tranches, loading, error } = useTranches(); + const { tranches } = useTranches(); - if (loading || !tranches) { + if (!tranches) { return ( @@ -26,14 +26,6 @@ const ClaimIndex = ({ name }: RouteChildProps) => { ); } - if (error) { - return ( - - {error} - - ); - } - let content = null; if (!account) { diff --git a/apps/token/src/routes/home/token-details/token-details.tsx b/apps/token/src/routes/home/token-details/token-details.tsx index 2f4412afb..caa33fc20 100644 --- a/apps/token/src/routes/home/token-details/token-details.tsx +++ b/apps/token/src/routes/home/token-details/token-details.tsx @@ -1,18 +1,12 @@ import { useTranslation } from 'react-i18next'; -import { - Callout, - EtherscanLink, - Intent, - Splash, -} from '@vegaprotocol/ui-toolkit'; +import { EtherscanLink } from '@vegaprotocol/ui-toolkit'; import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit'; import { ADDRESSES } from '../../../config'; import { useTranches } from '../../../hooks/use-tranches'; import type { BigNumber } from '../../../lib/bignumber'; import { formatNumber } from '../../../lib/format-number'; import { TokenDetailsCirculating } from './token-details-circulating'; -import { SplashLoader } from '../../../components/splash-loader'; export const TokenDetails = ({ totalSupply, @@ -23,24 +17,7 @@ export const TokenDetails = ({ }) => { const { t } = useTranslation(); - const { tranches, loading, error } = useTranches(); - - if (error) { - return ( - - {error} - - ); - } - - if (!tranches || loading) { - return ( - - - - ); - } - + const { tranches } = useTranches(); return ( diff --git a/apps/token/src/routes/redemption/redemption.tsx b/apps/token/src/routes/redemption/redemption.tsx index 38a6cf033..668745e52 100644 --- a/apps/token/src/routes/redemption/redemption.tsx +++ b/apps/token/src/routes/redemption/redemption.tsx @@ -28,7 +28,7 @@ const RedemptionRouter = () => { appState: { trancheBalances }, } = useAppState(); const { account } = useWeb3React(); - const { tranches, error, loading } = useTranches(); + const { tranches, error } = useTranches(); React.useEffect(() => { const run = (address: string) => { @@ -59,7 +59,7 @@ const RedemptionRouter = () => { ); } - if (!tranches || loading) { + if (!tranches) { return ( diff --git a/apps/token/src/routes/tranches/index.tsx b/apps/token/src/routes/tranches/index.tsx index 297f7e564..52916bc88 100644 --- a/apps/token/src/routes/tranches/index.tsx +++ b/apps/token/src/routes/tranches/index.tsx @@ -6,14 +6,14 @@ import { SplashLoader } from '../../components/splash-loader'; import { useDocumentTitle } from '../../hooks/use-document-title'; import { useTranches } from '../../hooks/use-tranches'; import type { RouteChildProps } from '..'; -import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit'; +import { Splash } from '@vegaprotocol/ui-toolkit'; const TrancheRouter = ({ name }: RouteChildProps) => { useDocumentTitle(name); const { t } = useTranslation(); - const { tranches, error, loading } = useTranches(); + const { tranches } = useTranches(); - if (!tranches || loading) { + if (!tranches) { return ( @@ -21,14 +21,6 @@ const TrancheRouter = ({ name }: RouteChildProps) => { ); } - if (error) { - return ( - - {error} - - ); - } - return ( <>