From 3193476277af88d5afd669869a1cc5b7d22a0290 Mon Sep 17 00:00:00 2001 From: Ross Bulat Date: Sat, 4 Jan 2025 13:25:25 +0700 Subject: [PATCH] chore: misc fixes --- packages/app/src/Router.tsx | 4 +--- packages/app/src/StakingApi/UnclaimedRewardsApi.tsx | 1 - packages/app/src/contexts/Payouts/index.tsx | 9 ++++----- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/app/src/Router.tsx b/packages/app/src/Router.tsx index edf05d05ea..a9f14b10c0 100644 --- a/packages/app/src/Router.tsx +++ b/packages/app/src/Router.tsx @@ -5,7 +5,6 @@ import { PagesConfig } from 'config/pages' import { useActiveAccounts } from 'contexts/ActiveAccounts' import { useNetwork } from 'contexts/Network' import { usePlugins } from 'contexts/Plugins' -import { useStaking } from 'contexts/Staking' import { useUi } from 'contexts/UI' import { useAccountFromUrl } from 'hooks/useAccountFromUrl' import { ErrorFallbackApp, ErrorFallbackRoutes } from 'library/ErrorBoundary' @@ -34,7 +33,6 @@ import { Body, Main } from 'ui-core/base' const RouterInner = () => { const { network } = useNetwork() - const { inSetup } = useStaking() const { pathname } = useLocation() const { setContainerRefs } = useUi() const { pluginEnabled } = usePlugins() @@ -60,7 +58,7 @@ const RouterInner = () => { return ( - {pluginEnabled('staking_api') && !inSetup() && activeAccount && ( + {pluginEnabled('staking_api') && activeAccount && ( )} diff --git a/packages/app/src/StakingApi/UnclaimedRewardsApi.tsx b/packages/app/src/StakingApi/UnclaimedRewardsApi.tsx index 5f5f1989d8..3180884dd0 100644 --- a/packages/app/src/StakingApi/UnclaimedRewardsApi.tsx +++ b/packages/app/src/StakingApi/UnclaimedRewardsApi.tsx @@ -10,7 +10,6 @@ import type { Props } from './types' export const UnclaimedRewardsApi = ({ activeAccount, network }: Props) => { const { activeEra } = useApi() const { setUnclaimedRewards } = usePayouts() - const { data, loading, error } = useUnclaimedRewards({ chain: network, who: activeAccount, diff --git a/packages/app/src/contexts/Payouts/index.tsx b/packages/app/src/contexts/Payouts/index.tsx index 7d7b12f133..6ed50b066a 100644 --- a/packages/app/src/contexts/Payouts/index.tsx +++ b/packages/app/src/contexts/Payouts/index.tsx @@ -4,7 +4,7 @@ import type { UnclaimedRewards } from 'plugin-staking-api/types' import type { ReactNode } from 'react' import { createContext, useContext, useState } from 'react' -import { defaultPayoutsContext } from './defaults' +import { defaultPayoutsContext, defaultUnclaimedRewards } from './defaults' import type { PayoutsContextInterface } from './types' export const PayoutsContext = createContext( @@ -14,10 +14,9 @@ export const PayoutsContext = createContext( export const usePayouts = () => useContext(PayoutsContext) export const PayoutsProvider = ({ children }: { children: ReactNode }) => { - const [unclaimedRewards, setUnclaimedRewards] = useState({ - total: '0', - entries: [], - }) + const [unclaimedRewards, setUnclaimedRewards] = useState( + defaultUnclaimedRewards + ) return (