Search within atoms (local search) first.
If no matches are found, make a request to the global-search endpoint in the API Client.
Only display suggestions if there are actual results to avoid showing an empty suggestion box.
If no local matches are found, call the global-search API.
Debounce API calls to avoid unnecessary requests on every keystroke.
Handle API responses properly and update suggestions if results exist.
🔹 Example (API Search with Debounce)
If suggestions exist, display them.
Otherwise, do not show the suggestion box.
🔹 Example (React Code for Conditional Rendering)
✅ Modify the search function to follow the correct priority (Atoms → Global Search).
✅ Ensure UI updates dynamically based on available suggestions.
✅ Optimize API calls with debouncing and avoid unnecessary renders.
Would you like help implementing this in your project? 🚀