Load accounts in bg
This commit is contained in:
parent
2a84f61a96
commit
6f3ecdea16
@ -33,6 +33,7 @@ interface Props {
|
||||
allStashes?: string[];
|
||||
className?: string;
|
||||
isOwnStash: boolean;
|
||||
isVisible: boolean;
|
||||
next: string[];
|
||||
onUpdateType: (stashId: string, type: 'validator' | 'nominator' | 'started' | 'other') => void;
|
||||
recentlyOnline?: DerivedHeartbeats;
|
||||
@ -91,15 +92,15 @@ function getStakeState (allAccounts: string[], allStashes: string[] | undefined,
|
||||
};
|
||||
}
|
||||
|
||||
function Account ({ allStashes, className, isOwnStash, next, onUpdateType, stakingOverview, stashId }: Props): React.ReactElement<Props> {
|
||||
function Account ({ allStashes, className, isOwnStash, isVisible, next, onUpdateType, stakingOverview, stashId }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { queueExtrinsic } = useContext(StatusContext);
|
||||
const { api } = useApi();
|
||||
const { allAccounts } = useAccounts();
|
||||
const validateInfo = useCall<ValidatorInfo>(api.query.staking.validators, [stashId]);
|
||||
const balancesAll = useCall<DerivedBalancesAll>(api.derive.balances.all as any, [stashId]);
|
||||
const stakingAccount = useCall<DerivedStakingAccount>(api.derive.staking.account as any, [stashId]);
|
||||
const stakingRewardsAll = useCall<DeriveStakerReward[]>(api.derive.staking.stakerRewards as any, [stashId]);
|
||||
const stakingAccount = isVisible ? useCall<DerivedStakingAccount>(api.derive.staking.account as any, [stashId]) : undefined;
|
||||
const stakingRewardsAll = isVisible ? useCall<DeriveStakerReward[]>(api.derive.staking.stakerRewards as any, [stashId]) : undefined;
|
||||
const [[stakingRewards, payoutEras], setStakingRewards] = useState<[DeriveStakerReward[], EraIndex[]]>([[], []]);
|
||||
const [{ controllerId, destination, hexSessionIdQueue, hexSessionIdNext, isLoading, isOwnController, isStashNominating, isStashValidating, nominees, sessionIds, validatorPrefs }, setStakeState] = useState<StakeState>({ controllerId: null, destination: 0, hexSessionIdNext: null, hexSessionIdQueue: null, isLoading: true, isOwnController: false, isStashNominating: false, isStashValidating: false, sessionIds: [] });
|
||||
const [activeNoms, setActiveNoms] = useState<string[]>([]);
|
||||
|
||||
@ -101,6 +101,7 @@ export default function Actions ({ allStashes, className, isVisible, next, recen
|
||||
activeEra={activeEra}
|
||||
allStashes={allStashes}
|
||||
isOwnStash={isOwnStash}
|
||||
isVisible={isVisible}
|
||||
key={stashId}
|
||||
next={next}
|
||||
onUpdateType={_onUpdateType}
|
||||
|
||||
@ -98,15 +98,6 @@ function StakingApp ({ basePath, className }: Props): React.ReactElement<Props>
|
||||
stakingOverview={stakingOverview}
|
||||
/>
|
||||
<Switch>
|
||||
<Route path={`${basePath}/actions`}>
|
||||
<Actions
|
||||
allStashes={allStashes}
|
||||
isVisible={pathname === `${basePath}/actions`}
|
||||
recentlyOnline={recentlyOnline}
|
||||
next={next}
|
||||
stakingOverview={stakingOverview}
|
||||
/>
|
||||
</Route>
|
||||
<Route path={[`${basePath}/query/:value`, `${basePath}/query`]}>
|
||||
<Query />
|
||||
</Route>
|
||||
@ -114,6 +105,13 @@ function StakingApp ({ basePath, className }: Props): React.ReactElement<Props>
|
||||
<Targets />
|
||||
</Route>
|
||||
</Switch>
|
||||
<Actions
|
||||
allStashes={allStashes}
|
||||
isVisible={pathname === `${basePath}/actions`}
|
||||
recentlyOnline={recentlyOnline}
|
||||
next={next}
|
||||
stakingOverview={stakingOverview}
|
||||
/>
|
||||
<Overview
|
||||
hasQueries={hasQueries}
|
||||
isVisible={[basePath, `${basePath}/waiting`].includes(pathname)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user