Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix address lookup reseting state after country #2926

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

m1aw
Copy link
Contributor

@m1aw m1aw commented Oct 28, 2024

Summary

This PR attempts to fix the bug reported in the issue where address or field were not being pre-filled correctly.

The issue was caused by the logic that applies on the country change hook, that resets the stateOrProvince Select, and re-triggers postal code validation.

This hook exists because we want to reset the stateOrProvince field when a country changes. This was also triggering when setting country via setSearchData, which lead to a race condition where stateOrProvince would be reset right after being set by setSearchData, because of the country change.

Tested scenarios

  • Created custom playground, passed US address
    • Switching between addresses applies the state correctly
    • It works when the billingAddressAllowedCountries is set to just one country
    • Switching to Canada, Brazil manually resets the state

Fixed issue:
#2832

Copy link

changeset-bot bot commented Oct 28, 2024

🦋 Changeset detected

Latest commit: 1273da3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@adyen/adyen-web Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 28, 2024

Size Change: -3 B (0%)

Total Size: 1.19 MB

Filename Size Change
packages/lib/dist/adyen.js 315 kB -1 B (0%)
packages/lib/dist/cjs/index.js 275 kB -1 B (0%)
packages/lib/dist/es/index.js 150 kB -1 B (0%)
ℹ️ View Unchanged
Filename Size
packages/lib/dist/es.modern/ar.js 7.41 kB
packages/lib/dist/es.modern/cs-CZ.js 6.52 kB
packages/lib/dist/es.modern/da-DK.js 5.9 kB
packages/lib/dist/es.modern/de-DE.js 6.4 kB
packages/lib/dist/es.modern/el-GR.js 8.36 kB
packages/lib/dist/es.modern/es-ES.js 6.04 kB
packages/lib/dist/es.modern/fi-FI.js 6.04 kB
packages/lib/dist/es.modern/fr-FR.js 6.24 kB
packages/lib/dist/es.modern/hr-HR.js 6.31 kB
packages/lib/dist/es.modern/hu-HU.js 6.6 kB
packages/lib/dist/es.modern/index.js 129 kB
packages/lib/dist/es.modern/it-IT.js 6.09 kB
packages/lib/dist/es.modern/ja-JP.js 7.1 kB
packages/lib/dist/es.modern/ko-KR.js 6.71 kB
packages/lib/dist/es.modern/nl-NL.js 6.04 kB
packages/lib/dist/es.modern/no-NO.js 5.92 kB
packages/lib/dist/es.modern/pl-PL.js 6.58 kB
packages/lib/dist/es.modern/pt-BR.js 6.08 kB
packages/lib/dist/es.modern/pt-PT.js 6.21 kB
packages/lib/dist/es.modern/ro-RO.js 6.37 kB
packages/lib/dist/es.modern/ru-RU.js 7.84 kB
packages/lib/dist/es.modern/sk-SK.js 6.69 kB
packages/lib/dist/es.modern/sl-SI.js 6.21 kB
packages/lib/dist/es.modern/sv-SE.js 5.88 kB
packages/lib/dist/es.modern/zh-CN.js 6.48 kB
packages/lib/dist/es.modern/zh-TW.js 6.62 kB
packages/lib/dist/es/ar.js 7.41 kB
packages/lib/dist/es/cs-CZ.js 6.52 kB
packages/lib/dist/es/da-DK.js 5.9 kB
packages/lib/dist/es/de-DE.js 6.4 kB
packages/lib/dist/es/el-GR.js 8.36 kB
packages/lib/dist/es/es-ES.js 6.04 kB
packages/lib/dist/es/fi-FI.js 6.04 kB
packages/lib/dist/es/fr-FR.js 6.24 kB
packages/lib/dist/es/hr-HR.js 6.31 kB
packages/lib/dist/es/hu-HU.js 6.6 kB
packages/lib/dist/es/it-IT.js 6.09 kB
packages/lib/dist/es/ja-JP.js 7.1 kB
packages/lib/dist/es/ko-KR.js 6.71 kB
packages/lib/dist/es/nl-NL.js 6.04 kB
packages/lib/dist/es/no-NO.js 5.92 kB
packages/lib/dist/es/pl-PL.js 6.58 kB
packages/lib/dist/es/pt-BR.js 6.08 kB
packages/lib/dist/es/pt-PT.js 6.21 kB
packages/lib/dist/es/ro-RO.js 6.37 kB
packages/lib/dist/es/ru-RU.js 7.84 kB
packages/lib/dist/es/sk-SK.js 6.69 kB
packages/lib/dist/es/sl-SI.js 6.21 kB
packages/lib/dist/es/sv-SE.js 5.88 kB
packages/lib/dist/es/zh-CN.js 6.48 kB
packages/lib/dist/es/zh-TW.js 6.62 kB

compressed-size-action

@m1aw m1aw merged commit c5eba2a into v5 Oct 28, 2024
10 checks passed
@m1aw m1aw deleted the fix/v5/address-lookup-reseting-state branch October 28, 2024 17:23
@github-actions github-actions bot mentioned this pull request Oct 28, 2024
Copy link

sonarcloud bot commented Oct 28, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
30.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

m1aw added a commit that referenced this pull request Oct 28, 2024
* fixes address lookup reseting state after country

* changeset

(cherry picked from commit c5eba2a)
m1aw added a commit that referenced this pull request Oct 30, 2024
* fixes address lookup reseting state after country

* changeset

(cherry picked from commit c5eba2a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants