fix: eliminate double VIES call on Verify click
Let the verifiedVatId useEffect handle the fetch instead of calling fetchVAT directly in handleVerifyVatId. Prevents VIES MS_MAX_CONCURRENT_REQ rate limiting.
This commit is contained in:
@@ -75,7 +75,7 @@ export default function PlanSummary({ plan, interval, limit, country, vatId, onC
|
|||||||
const handleVerifyVatId = () => {
|
const handleVerifyVatId = () => {
|
||||||
if (!vatId || !country) return
|
if (!vatId || !country) return
|
||||||
setVerifiedVatId(vatId)
|
setVerifiedVatId(vatId)
|
||||||
fetchVAT(country, vatId, currentInterval)
|
// useEffect on verifiedVatId will trigger the fetch
|
||||||
}
|
}
|
||||||
|
|
||||||
const isVatChecked = verifiedVatId !== '' && verifiedVatId === vatId
|
const isVatChecked = verifiedVatId !== '' && verifiedVatId === vatId
|
||||||
|
|||||||
Reference in New Issue
Block a user