fawmi / vue-google-maps

Reactive Vue 3 components for Google maps
https://vue-map.netlify.app
MIT License
196 stars 103 forks source link

Place Autocomplete Debounce #201

Open vdiaza opened 1 year ago

vdiaza commented 1 year ago

Is your feature request related to a problem? Please describe. Google maps autocomplete becomes very expensive on a large scale, this is due that it performs a request each time a key is pressed.

Describe the solution you'd like Best way to avoid sending too many requests is to add a debounce feature to wait x ms before sending a new request..

wavedeck commented 10 months ago

Maybe something like lodash‘s debounce function could do the trick on the change event handler.

chronicadventure commented 9 months ago

@wavedeck what do you mean add a debounce function on the change event handler? Are you talking about adding it to the place_changed event? If that's the case, that event is only fired when a user actually selects an item from the drop down, not when a key stroke is pressed.

Having said that, I think the way google bills is per "session", in which a session includes the autocomplete suggestions with a final getplacedetails call. So the billing issue might not be that big of a problem.