* Bumps w/ eslint * Additional * Additional * Additional * Additional * Remove style props * Additional * Additional * Additional * Additional (< 100) * eslint passes, tsc next * tsc fixes * Update deps * Update i18n
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
// Copyright 2017-2020 @polkadot/apps authors & contributors
|
|
// This software may be modified and distributed under the terms
|
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
|
|
|
import React, { useEffect, useState } from 'react';
|
|
import { useApi, useCall } from '@polkadot/react-hooks';
|
|
|
|
function WarmUp (): React.ReactElement {
|
|
const { api, isApiReady } = useApi();
|
|
const indexes = useCall<unknown>(isApiReady && api.derive.accounts?.indexes, []);
|
|
const registrars = useCall<unknown>(isApiReady && api.query.identity?.registrars, []);
|
|
const staking = null; // useCall<unknown>(isApiReady && api.derive.staking?.overview, []);
|
|
const issuance = useCall<unknown>(isApiReady && api.query.balances?.totalIssuance, []);
|
|
const [hasValues, setHasValues] = useState(false);
|
|
|
|
useEffect((): void => {
|
|
setHasValues(!!indexes || !!issuance || !!registrars || !!staking);
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
|
|
return (
|
|
<div className={`apps--api-warm ${hasValues.toString()}`} />
|
|
);
|
|
}
|
|
|
|
export default React.memo(WarmUp);
|