Skip to content

[Enhancement] Improve Search Request Handling to Prevent Excessive GitHub API Calls During Rapid Input #341

@Tanayajadhav1

Description

@Tanayajadhav1

Currently, repository and user search requests are triggered on nearly every keystroke in the search input field. When a user types quickly or frequently modifies the query, multiple overlapping API calls are sent to the GitHub API.

This behavior leads to inefficient API usage and degraded user experience.

Current Problems

During rapid typing, the application may experience:

  • Excessive GitHub API requests on every keystroke
  • Increased risk of hitting GitHub API rate limits
  • Out-of-order responses causing UI flickering or stale data display
  • Unnecessary network usage, especially on slow connections
  • Reduced responsiveness during fast input changes
  • Expected Behavior

The search system should behave in a controlled and optimized manner:

  • API requests should only trigger after the user pauses typing (debounced input)
  • Previous in-flight requests should be cancelled when a new query is entered
  • Only the latest response should update the UI
  • Optional: Ignore requests for very short or empty queries
  • Proposed Solution

Implement optimized search request handling using the following techniques:

  1. Debouncing Input

Introduce a delay (300–500ms) before triggering API requests after user stops typing.

  1. Request Cancellation

Use AbortController (or Axios cancellation tokens if applicable) to cancel previous in-flight requests when a new search begins.

  1. Query Validation (Optional Improvement)
    Prevent API calls for empty or very short inputs
    Add minimum character threshold (e.g., 2–3 characters)

Implementing this fix will:

  • Reduce unnecessary GitHub API calls
  • Improve search responsiveness and UI smoothness
  • Prevent stale or outdated results from rendering
  • Reduce risk of hitting API rate limits
  • Improve scalability of the application under heavy usage

Suggested Labels
gssoc26, level:critical, enhancement, frontend, enhancement

As a GSSoC contributor, I would like to work on this issue. Please assign it to me .

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions