Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Remove "magic" heuristics

primal100148fd7ca6f70
diff --git a/saleor/static/js/components/address-form.js b/saleor/static/js/components/address-form.js
index 23ce9cc0c3..3d61fd5d44 100644
--- a/saleor/static/js/components/address-form.js
+++ b/saleor/static/js/components/address-form.js
@@ -9,44 +9,6 @@ export default $(document).ready((e) => {
$previewField.val('on');
$form.submit();
});
- const $countryAreaList = $form.find('#country_area_list');
- if ($countryAreaList) {
- const $countryAreaField = $form.find('input[name=country_area]');
- const countryAreaOptions = $countryAreaList.find('option').toArray().reduce((options, option) => {
- option = $(option);
- let value = option.val();
- let text = option.text();
- options.push(value);
- if (option !== text) {
- options.push(text);
- }
- return options;
- }, []);
- let countryAreaTimeout = null;
- $countryAreaField.on('change', () => {
- clearTimeout(countryAreaTimeout);
- countryAreaTimeout = setTimeout(() => {
- let lowerCaseValue = $countryAreaField.val().toLowerCase();
- if (lowerCaseValue) {
- let value = countryAreaOptions.find(val => val.toLowerCase() === lowerCaseValue);
- if (value) {
- $countryAreaField.val(value);
- } else {
- let value = countryAreaOptions.find(val => val.toLowerCase().startsWith(lowerCaseValue));
- if (value) {
- $countryAreaField.val(value);
- } else {
- let value = countryAreaOptions.find(val => val.toLowerCase().includes(lowerCaseValue));
- if (value) {
- $countryAreaField.val(value);
- }
- }
- }
- }
- }, 500);
- });
- $countryAreaField.trigger('change');
- };
});
});