mapbox-gl-geocoder icon indicating copy to clipboard operation
mapbox-gl-geocoder copied to clipboard

Configurable debounce delay

Open kvalev opened this issue 4 years ago • 3 comments

Allow the users to configure the debounce delay, which might be helpful when querying an externalGeocoder.

  • [x] briefly describe the changes in this PR
  • [ ] write tests for all new functionality
  • [x] run npm run docs and commit changes to API.md
  • [x] update CHANGELOG.md with changes under master heading before merging

kvalev avatar Oct 12 '21 19:10 kvalev

Thanks for the PR. My view is per #185 we shouldn't be using debounce at all and instead use throttle. I'd like to see more thought and discussion and ultimately a decision on this point before we go adding to the API. If we add this to the API now then swap to throttle it would be a breaking change which is something we should try to avoid.

andrewharvey avatar Oct 18 '21 22:10 andrewharvey

Thanks for the PR. My view is per #185 we shouldn't be using debounce at all and instead use throttle. I'd like to see more thought and discussion and ultimately a decision on this point before we go adding to the API. If we add this to the API now then swap to throttle it would be a breaking change which is something we should try to avoid.

throttling would fire the first event and then wait for a given time until the next event fires. debounce would cancel events until a threshold has been met.

a debounce would be helpful to make the first event as late as possible, while throttle would prevent the app to fire repeatedly within a given period.

why not both?

wibed avatar Dec 26 '22 03:12 wibed