Skip to content

Commit

Permalink
Fix postal code autocompletion on paste
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisermann committed Oct 31, 2019
1 parent b15ff29 commit 9cdb3ea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,32 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Postal code autocompletion on paste.

## [3.6.10] - 2019-10-29

### Changed

- Update Ecuador rules, including some parishes for Pichincha province.

## [3.6.9] - 2019-10-28

### Added

- Add German translations.

## [3.6.8] - 2019-10-21

### Changed

- Add address examples in geolocation mode for some countries

## [3.6.7] - 2019-10-17

### Fixed

- Update Chile postal code for some regions.

## [3.6.6] - 2019-10-14
Expand Down
12 changes: 8 additions & 4 deletions react/AddressContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ class AddressContainer extends Component {
changedAddressFields.postalCode &&
!changedAddressFields.postalCode.geolocationAutoCompleted
) {
const postalCodeIsNowValid =
address.postalCode.valid !== true &&
validatedAddress.postalCode.valid === true
const diffFromPrev =
address.postalCode.value !== validatedAddress.postalCode.value
const isValidPostalCode = validatedAddress.postalCode.valid === true
const shouldAutoComplete =
rules.postalCodeFrom === POSTAL_CODE &&
diffFromPrev &&
isValidPostalCode

if (rules.postalCodeFrom === POSTAL_CODE && postalCodeIsNowValid) {
if (shouldAutoComplete) {
return onChangeAddress(
postalCodeAutoCompleteAddress({
cors,
Expand Down

0 comments on commit 9cdb3ea

Please sign in to comment.