Reset lookup results when chain or contract changes

pull/5285/head
Manuel Wedler 4 months ago committed by Aniket
parent a2d3b84019
commit 456448d7d6
  1. 13
      apps/contract-verification/src/app/views/LookupView.tsx

@ -1,4 +1,4 @@
import { useContext, useState } from 'react' import { useContext, useEffect, useState } from 'react'
import { SearchableChainDropdown, ContractAddressInput } from '../components' import { SearchableChainDropdown, ContractAddressInput } from '../components'
import { mergeChainSettingsWithDefaults, validConfiguration } from '../utils' import { mergeChainSettingsWithDefaults, validConfiguration } from '../utils'
import type { LookupResponse, VerifierIdentifier, Chain } from '../types' import type { LookupResponse, VerifierIdentifier, Chain } from '../types'
@ -21,7 +21,18 @@ export const LookupView = () => {
const submitDisabled = !!contractAddressError || !contractAddress || !selectedChain const submitDisabled = !!contractAddressError || !contractAddress || !selectedChain
// Reset results when chain or contract changes
useEffect(() => {
setLookupResult({})
setLoadingVerifiers({})
}, [selectedChain, contractAddress])
const handleLookup = (e) => { const handleLookup = (e) => {
if (Object.values(loadingVerifiers).some((loading) => loading)) {
console.error('Lookup request already running')
return
}
e.preventDefault() e.preventDefault()
for (const verifierId of VERIFIERS) { for (const verifierId of VERIFIERS) {

Loading…
Cancel
Save