Skip to content

Commit

Permalink
Bug #58753: Fix autoselecting prefilled address with multiple matches
Browse files Browse the repository at this point in the history
* Tweak codestyle.
  • Loading branch information
JerrySmidt committed May 23, 2024
1 parent 62f5d81 commit cdfb7d0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions assets/js/postcode-eu-autofill.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,11 +580,10 @@

autocompleteInstance.getSuggestions = function (context, term, response)
{
let encodedTerm = new TextEncoder().encode(term);
let binaryTerm = Array.from(encodedTerm, (byte) =>
String.fromCodePoint(byte),
).join("");
const url = this.options.autocompleteUrl.replace('${context}', encodeURIComponent(context)).replace('${term}', encodeURIComponent(btoa(binaryTerm)));
const encodedTerm = new TextEncoder().encode(term),
binaryTerm = Array.from(encodedTerm, (byte) => String.fromCodePoint(byte)).join(''),
url = this.options.autocompleteUrl.replace('${context}', encodeURIComponent(context)).replace('${term}', encodeURIComponent(btoa(binaryTerm)));

return this.xhrGet(url, response);
}

Expand Down Expand Up @@ -652,7 +651,7 @@
if (prefilledAddressValue !== '')
{
const oneTimeHandler = () => {
if (isSingleAddressMatch)
if (isSingleAddressMatch() === true)
{
selectAutocompleteAddress(matches[0]);
}
Expand Down

0 comments on commit cdfb7d0

Please sign in to comment.