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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user