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)} onChange={(e) => setCustomNodeText(e.target.value)}
/> />
<Link <Link
aria-disabled={!customNodeText} aria-disabled={
!customNodeText ||
getIsNodeLoading(state[CUSTOM_NODE_KEY])
}
onClick={() => { onClick={() => {
setNetworkError(null); setNetworkError(null);
updateNodeUrl(CUSTOM_NODE_KEY, customNodeText); 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 { CUSTOM_NODE_KEY, ErrorType } from '../types';
import type { Networks, NodeData } from '../types'; import type { Networks, NodeData } from '../types';
export const getIsNodeLoading = ({ export const getIsNodeLoading = (node?: NodeData): boolean => {
chain, if (!node) return false;
responseTime,
block,
ssl,
}: NodeData) => {
return ( return (
chain.isLoading || node.chain.isLoading ||
responseTime.isLoading || node.responseTime.isLoading ||
block.isLoading || node.block.isLoading ||
ssl.isLoading node.ssl.isLoading
); );
}; };