feat(repo): add Octokit request timeouts and retry UI

Before, every GitHub call awaited indefinitely with no AbortSignal,
so a "lie-fi" connection (technically online, effectively dead) left
FluxNote stuck on the skeleton loader and the freshness badge spinning
forever. Inject an 8s AbortSignal.timeout via octokit.hook.before
(20s override on the recursive tree fetch), classify failures in the
userRepo store as auth vs network, and surface a "Couldn't reach
GitHub" retry button when no cached content is available.
This commit is contained in:
Julien Calixte
2026-05-16 23:28:11 +02:00
parent de7ac8d096
commit fc4ed188d7
5 changed files with 130 additions and 10 deletions

View File

@@ -30,7 +30,8 @@ export const getFiles = async (
owner,
repo,
tree_sha: lastCommit.commit.tree.sha,
recursive: "true"
recursive: "true",
request: { signal: AbortSignal.timeout(20_000) }
}
)
@@ -82,6 +83,10 @@ export const getMainReadme = async (owner: string, repo: string) => {
if (cachedReadme) {
return render(cachedReadme.content)
}
// No cached fallback — surface the error so the caller can classify
// network/timeout failures vs auth/404 and tailor the UI accordingly.
throw error
}
return null