Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions frontend/src/hooks/useProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +76 to +82

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The retry predicate relies on matching error.message strings ("Not Found"/"Forbidden"). Since ProjectsService errors are ApiError with a stable numeric status, it would be more robust to branch on error.status === 404/403 (or to derive status with optional chaining) rather than on the message text. This also mirrors the status-based checks used elsewhere in the frontend and avoids breakage if the error mapping/message ever changes.

Copilot uses AI. Check for mistakes.
},
})
return { readmeRequest }
}
Expand Down