You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The debounce feature is just delaying the execution of the request code, and not eliminating the unnecessary requests.
For example, if I set a debounce interval and type "Los Angeles" quick enough on the field, it is doing 11 requests ("L", "Lo", "Los", ..., "Los Angeles") after an interval. The expected behavior for a debounced operation would be to do only one request ("Los Angeles") after the interval.
Reproduction - (required - issue will be closed without this)
To reproduce:
Add a GooglePlacesAutocomplete inside your app, with debounce of ~200ms
Use Flipper (or some alternative) to monitor the API calls done by the app
Type "Los Angeles" quick on the auto complete field
Notice that Flipper will show 11 calls to Google API: "L", "Lo", "Los", "Los ", "Los A", ...
The expected would be only one call with "Los Angeles" after the last letter was typed, and the debounce time was passed.
Describe the bug
The debounce feature is just delaying the execution of the request code, and not eliminating the unnecessary requests.
For example, if I set a debounce interval and type "Los Angeles" quick enough on the field, it is doing 11 requests ("L", "Lo", "Los", ..., "Los Angeles") after an interval. The expected behavior for a debounced operation would be to do only one request ("Los Angeles") after the interval.
Reproduction - (required - issue will be closed without this)
To reproduce:
Additional context
Library Version: 2.5.1
React Native Version: not relevant
iOS
Android
Web
If you are using expo please indicate here:
Fix
This is happening because we are calling
_.debounce
many times with different contexts. I fixed it using setTimeout on my own fork:https://github.com/iuricernov/react-native-google-places-autocomplete/tree/debounce-fix
The diff that fixes the issue:
master...iuricernov:react-native-google-places-autocomplete:debounce-fix
The text was updated successfully, but these errors were encountered: