fix: make check link unclickable while loading (#928)

* fix: make check link unclickable while loading

* fix: format
This commit is contained in:
botond 2022-08-01 12:59:48 +01:00 committed by GitHub
parent 7b4e618689
commit b1ded718a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 11 deletions

View File

@ -169,7 +169,10 @@ export const NodeSwitcher = ({
onChange={(e) => setCustomNodeText(e.target.value)}
/>
<Link
aria-disabled={!customNodeText}
aria-disabled={
!customNodeText ||
getIsNodeLoading(state[CUSTOM_NODE_KEY])
}
onClick={() => {
setNetworkError(null);
updateNodeUrl(CUSTOM_NODE_KEY, customNodeText);

View File

@ -2,17 +2,13 @@ import { t } from '@vegaprotocol/react-helpers';
import { CUSTOM_NODE_KEY, ErrorType } from '../types';
import type { Networks, NodeData } from '../types';
export const getIsNodeLoading = ({
chain,
responseTime,
block,
ssl,
}: NodeData) => {
export const getIsNodeLoading = (node?: NodeData): boolean => {
if (!node) return false;
return (
chain.isLoading ||
responseTime.isLoading ||
block.isLoading ||
ssl.isLoading
node.chain.isLoading ||
node.responseTime.isLoading ||
node.block.isLoading ||
node.ssl.isLoading
);
};