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

Feature/ID-4218 #660

Merged
merged 9 commits into from
Sep 2, 2024
Merged

Conversation

armine-fliplet
Copy link
Contributor

@armine-fliplet armine-fliplet commented Aug 28, 2024

Product areas affected

Form Builder, Address Field

What does this PR do?

Integrates Address field type and settings

JIRA ticket

ID-4218

Arpanexe
Arpanexe previously approved these changes Aug 29, 2024
Copy link
Contributor

@Arpanexe Arpanexe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

js/components/address.js Outdated Show resolved Hide resolved
value = !value;
}

var fields = this.$parent.fields;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armine-fliplet, please avoid using var

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dwfliplet Done

Comment on lines 207 to 215
await this.addressField.getAutocompleteSuggestions(input, countryRestrictions)
.then(suggestions => {
if (typeof this.value === 'object') {
this.addressSuggestions = [];
this.suggestionSelected = true;
} else {
this.addressSuggestions = suggestions;
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armine-fliplet, you should never combine await with then.

Suggested change
await this.addressField.getAutocompleteSuggestions(input, countryRestrictions)
.then(suggestions => {
if (typeof this.value === 'object') {
this.addressSuggestions = [];
this.suggestionSelected = true;
} else {
this.addressSuggestions = suggestions;
}
});
const suggestions = await this.addressField.getAutocompleteSuggestions(input, countryRestrictions);
if (typeof this.value === 'object') {
this.addressSuggestions = [];
this.suggestionSelected = true;
} else {
this.addressSuggestions = suggestions;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dwfliplet Done

js/components/address.js Outdated Show resolved Hide resolved
js/components/address.js Outdated Show resolved Hide resolved
js/libs/core.js Outdated Show resolved Hide resolved
js/libs/core.js Outdated Show resolved Hide resolved
js/libs/core.js Outdated Show resolved Hide resolved
js/libs/core.js Outdated
var $vm = this;
var countries;

fetch('https://restcountries.com/v3.1/all').then(function(response) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armine-fliplet, what's that? Why do we create some third-party dependency here? The list of countries doesn't change that often. Especially since we use only part of the info. Please extract the needed data into a separate file, and store it inside the project.

Copy link
Contributor Author

@armine-fliplet armine-fliplet Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dwfliplet Are you suggesting we keep the data static, or should we get it from the API and keep in a separate file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armine-fliplet to keep data static, but it can be kept in separate file, or even fetched from json file but hosted on our side

Arpanexe
Arpanexe previously approved these changes Aug 30, 2024
Copy link
Contributor

@Arpanexe Arpanexe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@armine-fliplet armine-fliplet changed the base branch from master to projects/ID-4110-address-field September 2, 2024 07:11
@inna-bieshulia inna-bieshulia merged commit 81fb93f into projects/ID-4110-address-field Sep 2, 2024
2 checks passed
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.

4 participants