Fix a search input that spams requests by adding a JavaScript debouncing wrapper, so the search only fires after the user stops typing.
The input currently triggers a search on every keystroke, causing too many requests. Implement a debounce that delays the search until a short pause in typing (e.g., 300ms).
Use setTimeout/clearTimeout to reset the timer on each keystroke, executing the search only after the user stops typing for the delay period.
Make sure the debounce works for rapid typing and that the final search reflects the last entered value.
Test by typing quickly and confirming only one search fires after the pause.