fix: prevent price flash on VAT ID keystroke

Only re-fetch VAT when clearing a previously verified VAT ID,
not on every keystroke when nothing was verified yet.
This commit is contained in:
Usman Baig
2026-03-27 12:22:33 +01:00
parent 342d86c26d
commit c7cf50ef1d

View File

@@ -63,9 +63,9 @@ export default function PlanSummary({ plan, interval, limit, country, vatId, onC
fetchVAT(country, verifiedVatId, currentInterval)
}, [country, currentInterval, fetchVAT, verifiedVatId])
// Clear verified state when VAT ID input changes
// Clear verified state when VAT ID input changes after a successful verification
useEffect(() => {
if (vatId !== verifiedVatId) {
if (verifiedVatId !== '' && vatId !== verifiedVatId) {
setVerifiedVatId('')
// Re-fetch without VAT ID to show the 21% rate
if (country) fetchVAT(country, '', currentInterval)