actengage / vue-place-autocomplete

A Vue component for the Google Place Autocomplete API.
Other
26 stars 27 forks source link

Fix options loop to pull options in props #5

Closed daronspence closed 4 years ago

daronspence commented 4 years ago

Hey! We're using this on a project and ran into a little bug when trying to add types options. Idk if this has always been the case, but using the for loop was only returning the index of the option and in the array and not the key.

Hopefully this should be a quick and easy thing to merge in? As it is, I believe this is broken for everyone, though admittedly, they might be relying on that broken implementation.

Thanks!

actengage commented 4 years ago

Can you explain why this change is necessary? The code basically does the exact same thing right?

daronspence commented 4 years ago

@actengage you would think so, but unfortunately they don't.

I moved the code into a pen that you can look at. https://codepen.io/daronspence/pen/QWbLRgN?editors=0012

If you look in the console, you'll see the responses from the two loops are completely different.

Hopefully that helps!

actengage commented 4 years ago

Right. I actually knew that was the intended behavior, however I didn't set the key properly. Your solution makes more sense.

trasigor commented 4 years ago

Can you please also publish this fix to npm repository? It seems that it is still isn't updated.