Skip to content

Commit

Permalink
Merge pull request #134 from vtex-apps/fix/invisible-postalcode-valid…
Browse files Browse the repository at this point in the history
…ation

Set the useGeolocation flag when using geolocation
  • Loading branch information
kaisermann authored Nov 18, 2019
2 parents bc99f49 + 403aadd commit 9b6df12
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"editor.formatOnSave": true,
"prettier.eslintIntegration": true,
"eslint.validate": [
{
"language": "javascript",
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Invisible postal code invalidation when editing an address.

## [0.30.0] - 2019-11-13

### Added
Expand Down
12 changes: 6 additions & 6 deletions react/components/Addresses/AddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,11 @@ class AddressForm extends Component<InnerProps & OuterProps, State> {
// allow to edit only with geolocation component
if (
this.hasGeolocationPreference() &&
curAddress.postalCode &&
curAddress.postalCode.geolocationAutoCompleted &&
newAddress.postalCode &&
!newAddress.postalCode.geolocationAutoCompleted
newAddress.addressQuery &&
!newAddress.addressQuery.geolocationAutoCompleted
) {
AUTO_COMPLETABLE_FIELDS.forEach(field => {
newAddress[field].value = null
delete newAddress[field].geolocationAutoCompleted
delete newAddress[field].valid
})
}
Expand Down Expand Up @@ -145,7 +142,10 @@ class AddressForm extends Component<InnerProps & OuterProps, State> {
const hasAutoCompletedFields = this.hasAutoCompletedFields()

return (
<AddressRules country={address.country.value} shouldUseIOFetching>
<AddressRules
country={address.country.value}
shouldUseIOFetching
useGeolocation={prefersGeolocation}>
<AddressContainer
address={address}
Input={StyleguideInput}
Expand Down

0 comments on commit 9b6df12

Please sign in to comment.