Skip to content

Commit

Permalink
Refactor debounceCheckRpc function in SpawnRPC.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
truemiller committed Mar 4, 2024
1 parent abdfa9a commit 291f740
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/components/Spawn/SpawnRPC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ export const SpawnRPC = ({ nextPage }: { nextPage: SpawnScreen }) => {

// eslint-disable-next-line react-hooks/exhaustive-deps
const debounceCheckRpc = useCallback(
debounce((_rpc: string) => {
debounce((rpcInput: string) => {
if (isCheckingRpc) return;
if (!_rpc || rpc.slice(0, 4) !== 'http') {
if (!rpcInput || rpc.slice(0, 4) !== 'http') {
setRpcState(RPCState.INVALID);
return;
}
setIsCheckingRpc(true);
EthersService.checkRpc(_rpc)
EthersService.checkRpc(rpcInput)
.then((valid: boolean) =>
setRpcState(valid ? RPCState.VALID : RPCState.INVALID),
)
Expand Down

0 comments on commit 291f740

Please sign in to comment.