AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

React Query Spam On GitHub Authorization Endpoint Due To Missing Retry: False

useGitHubAuthorizationQuery makes redundant retries (3x by default) for 404 responses because retry: false specified in a FIXME was not implemented.

mediumConfidence 85%React

Origin Analysis

React Query defaults to retrying failed queries three times. The useGitHubAuthorizationQuery hook does not override this default, so requests that return 404 (e.g., user not authorized) are retried unnecessarily. A FIXME comment already suggested retry: false but it was not applied.
1. Open a page mounting useGitHubAuthorizationQuery, such as the Branching modal or Integrations settings. 2. Ensure the GitHub authorization endpoint returns 404 (e.g., not authorized or endpoint unavailable). 3. Observe network tab: the same request is sent multiple times (initial + 3 retries).

Fixing Code Block

import { useQuery } from '@tanstack/react-query'; export function useGitHubAuthorizationQuery() { return useQuery({ queryKey: ['github-authorization'], queryFn: fetchGitHubAuthorization, retry: false, }); }
Setting retry: false prevents React Query from automatically retrying failed requests, which is appropriate here because 404 is an expected response indicating the user has not authorized GitHub. This stops the redundant network calls.

Edge Case Audit

Disabling retries entirely may cause transient network errors to fail immediately without automatic recovery, potentially degrading UX if the endpoint becomes temporarily unavailable. To mitigate, consider a conditional retry that only retries on non-404 errors (e.g., retry: (failureCount, error) => error.status !== 404). Rollback: revert the change or set retry: 1 if spamming recurs.

Ecosystem Topology