fix(predict): cp-7.62.0 debounce search input in PredictSearchOverlay#24820
fix(predict): cp-7.62.0 debounce search input in PredictSearchOverlay#24820
Conversation
Add 200ms debounce to search query to prevent API calls on every keystroke. Uses existing useDebouncedValue hook for consistency with codebase patterns.
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThe changes are isolated to the Predictions feature (PredictFeed component). The modifications add a debounce mechanism to the search functionality in the PredictSearchOverlay component:
The changes are well-contained within the Predict feature, use an existing utility hook (useDebouncedValue), and include proper unit test coverage. No core wallet functionality, controllers, or critical paths are affected. Only SmokePredictions tag is needed to verify the Predictions feature works correctly with this enhancement. |
|



Description
The PredictSearchOverlay component was triggering API requests for every character typed in the search input. This caused excessive network requests and poor UX.
Solution: Added a 200ms debounce to the search query using the existing
useDebouncedValuehook, which is already used throughout the codebase for similar search functionality (Bridge, Card onboarding, Trending tokens, etc.).Changes:
useDebouncedValuehook in PredictSearchOverlayusePredictMarketDatainstead of raw search queryisDebouncingandisFetchingstates for seamless loading UXChangelog
CHANGELOG entry: Fixed search input triggering excessive API calls in Predictions
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/PRED-486
Manual testing steps
Screenshots/Recordings
Before
API call triggered on every keystroke (network tab shows multiple requests)
After
Single API call after 200ms debounce delay
Screen.Recording.2026-01-16.at.10.09.58.AM.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Introduces a 200ms debounce for search in
PredictSearchOverlayto reduce request churn and smooth UX.useDebouncedValueand routesqinusePredictMarketDatato the debounced value; addsSEARCH_DEBOUNCE_MS = 200isSearchLoadingto show skeleton loaders during debounce and network fetchuseDebouncedValue, verify debounced query usage, loading skeletons during debounce, results after debounce, and the 200ms delay contractWritten by Cursor Bugbot for commit 1e2f1df. This will update automatically on new commits. Configure here.