From 1bcfec486c7f46e04bf0aa24f462b939768bd6bf Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Mon, 20 Apr 2026 01:36:25 -0700 Subject: [PATCH] fix(frontend): don't retry project README fetch on 404/403 Closes #572. `useProjectReadme` relied on React Query's default retry policy (3 attempts), so fetching `README.md` from a project that has none burned four round-trips before settling on "no README". A missing README is the common case for fresh projects, so the retries are pure latency with no chance of success. Adopts the same retry policy already used by `useProject` above it (lines 16-21): drop retries on "Not Found" and "Forbidden", otherwise fall back to up to three attempts for transient errors. Pattern is already in the codebase, so this keeps the retry behaviour consistent across the two hooks. --- frontend/src/hooks/useProject.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/hooks/useProject.ts b/frontend/src/hooks/useProject.ts index dcc08ee0..44706660 100644 --- a/frontend/src/hooks/useProject.ts +++ b/frontend/src/hooks/useProject.ts @@ -73,6 +73,14 @@ const useProjectReadme = ( path: "README.md", ref, }), + retry: (failureCount, error) => { + // A missing README is the common case for fresh projects — don't + // burn three extra round-trips before the UI settles on "no README". + if (error.message === "Not Found" || error.message === "Forbidden") { + return false + } + return failureCount < 3 + }, }) return { readmeRequest } }