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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user