OWASP / OWASP/Nest

Fix: Overlapping search requests and redundant network calls on /contribute page

Open
#3,439 5 comments 0 reactions 2 assignees Claimed by @Shubb07 View on GitHub
enhancement
Dominant language
Python
Stars
451
Forks
707
Avg merge
22h 59m
Merged PRs (30d)
91

Description

**Describe the issue**
The contribute page search currently triggers multiple in-flight search requests when users type/search repeatedly (more noticeable on slow networks).

The implementation has debounce, but it still lacks:
- Request cancellation (AbortController)
- Stale-response protection (“latest request wins” / requestId guard)
- Caching for repeated queries

Because of this, repeated searches always take time (always refetch), and under network delay, an older response can overwrite the latest results, causing flicker or mismatched results.

**Code references**
- [frontend/src/components/Search.tsx](https://github.com/OWASP/Nest/blob/main/frontend/src/components/Search.tsx)
Debounces input then calls **onSearch(query)** directly.
- [frontend/src/components/MultiSearch.tsx](https://github.com/OWASP/Nest/blob/main/frontend/src/components/MultiSearch.tsx)
Fires parallel requests using **Promise.all(...)** and updates state directly (**setSuggestions(...)**) without checking if the query is still the latest one.

**Expected behavior**
- Only the latest search query should update the UI.
- Older in-flight requests should be cancelled or ignored safely.
- Repeated queries should be served faster by reusing recently fetched results (when valid), reducing unnecessary network calls.

**Are you going to work on fixing this?**
- [x] Yes
- [] No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.