Skip to content

Commit

Permalink
fix: coderabbit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed Oct 25, 2024
1 parent 10d4352 commit 0826b79
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
6 changes: 5 additions & 1 deletion apps/router/src/gateway-ui/Gateway.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ export const Gateway = () => {
</TabList>
<Divider orientation='vertical' />
<TabPanels flex={1} width='100%'>
<TabPanel>{state.balances && <WalletCard />}</TabPanel>
{state.balances && (
<TabPanel>
<WalletCard />
</TabPanel>
)}
<TabPanel>
<LightningCard />
</TabPanel>
Expand Down
5 changes: 3 additions & 2 deletions apps/router/src/gateway-ui/components/walletModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ export const CreateButton: React.FC<{
onClick: () => void;
label: string;
isLoading?: boolean;
}> = ({ onClick, label, isLoading }) => (
isDisabled?: boolean;
}> = ({ onClick, label, isLoading, isDisabled }) => (
<Button
onClick={onClick}
size='lg'
width='100%'
isLoading={isLoading}
isDisabled={isLoading}
isDisabled={isDisabled}
>
{label}
</Button>
Expand Down
5 changes: 4 additions & 1 deletion apps/router/src/hooks/gateway/useGateway.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export const useLoadGateway = () => {
fetchInfoAndConfigs();
fetchBalances();

const interval = setInterval(fetchInfoAndConfigs, 5000);
const interval = setInterval(() => {
fetchInfoAndConfigs();
fetchBalances();
}, 5000);
return () => clearInterval(interval);
}
}, [state.needsAuth, api, dispatch]);
Expand Down
32 changes: 19 additions & 13 deletions apps/router/src/hooks/guardian/useGuardianSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,25 @@ export const useHandleBackgroundGuardianSetupActions = (
const [isPollingConsensus, setIsPollingConsensus] = useState(false);

const fetchConsensusState = useCallback(async () => {
const consensusState = await api.getConsensusConfigGenParams();
dispatch({
type: SETUP_ACTION_TYPE.SET_OUR_CURRENT_ID,
payload: consensusState.our_current_id,
});
dispatch({
type: SETUP_ACTION_TYPE.SET_PEERS,
payload: Object.values(consensusState.consensus.peers),
});
dispatch({
type: SETUP_ACTION_TYPE.SET_CONFIG_GEN_PARAMS,
payload: consensusState.consensus,
});
try {
const consensusState = await api.getConsensusConfigGenParams();
dispatch({
type: SETUP_ACTION_TYPE.SET_OUR_CURRENT_ID,
payload: consensusState.our_current_id,
});
dispatch({
type: SETUP_ACTION_TYPE.SET_PEERS,
payload: Object.values(consensusState.consensus.peers),
});
dispatch({
type: SETUP_ACTION_TYPE.SET_CONFIG_GEN_PARAMS,
payload: consensusState.consensus,
});
} catch (error) {
throw new Error(
`Failed to fetch consensus state: ${(error as Error).message}`
);
}
}, [api, dispatch]);

useEffect(() => {
Expand Down

0 comments on commit 0826b79

Please sign in to comment.