MLH-Fellowship / prep-project-22.AUG.PREP.2

MLH Prep Project for Pod 22.JUL.AUG.2
https://prep-22-aug-prep-2-project.netlify.app/
MIT License
3 stars 13 forks source link

Debounce user input to decrease unnecessary API calls #21

Closed omeiirr closed 2 years ago

omeiirr commented 2 years ago

We can use the Lodash debounce function to only call the API once every few keystrokes, instead of calling it at every single keystroke. This would help reduce the number of API calls being made.

omeiirr commented 2 years ago

Or do we want to use the dropdown/auto-suggest field for selecting cities?

Ahmedsaed commented 2 years ago

I fixed it by waiting until the user stops typing for 1 second then it sends the request

I will push the code after the map changes are merged to avoid conflicts

https://user-images.githubusercontent.com/37080003/184258592-9880d256-f402-4743-88dc-80bca3b54419.mp4