Skip to content

fix(contributors): prevent visitor-side GitHub requests when contributor data is unavailable - #1124

Open
castrojo wants to merge 1 commit into
projectbluefin:v4from
castrojo:fix-contributors-unavailable-1097
Open

fix(contributors): prevent visitor-side GitHub requests when contributor data is unavailable#1124
castrojo wants to merge 1 commit into
projectbluefin:v4from
castrojo:fix-contributors-unavailable-1097

Conversation

@castrojo

@castrojo castrojo commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #1097.

fetch-contributors.js previously wrote an empty object to static/data/file-contributors.json whenever every commit-fetch request for a build failed (e.g. missing GITHUB_TOKEN/GH_TOKEN, or rate limiting). PageContributors.tsx treats any missing key in that dataset as a per-page cache miss and falls back to an unauthenticated api.github.com request from the visitor's browser — meaning every page footer on the site would hit GitHub's API directly when the build-time dataset was globally unavailable.

Changes

  • scripts/fetch-contributors.js: when a complete fetch run finishes with zero successful files (and there were files to process), emit a sentinel __contributors_unavailable__: true payload instead of {}.
  • src/components/PageContributors.tsx: detect that sentinel on load and skip the client-side GitHub API fallback entirely when the whole dataset is unavailable, instead of issuing a request per page. LocalStorage cache lookups are unaffected.

Testing

  • npx tsc --noEmit — no new errors (pre-existing unrelated error in MusicPlaylist.tsx).
  • npx eslint src/components/PageContributors.tsx scripts/fetch-contributors.js — no new warnings/errors.
  • node -c scripts/fetch-contributors.js — syntax OK.

— hive: backend=copilot model=claude-sonnet-5

🐝 Hive Agent: contributor | SHA: cd35e595

…tor data is unavailable

When fetch-contributors.js fails to fetch commits for every file (e.g. no
GitHub token during build, or rate limited), it previously wrote an empty
object to file-contributors.json. PageContributors.tsx then treated every
missing key as a per-page cache miss and fell back to an unauthenticated
GitHub API request from each visitor's browser on every page footer.

Emit a sentinel '__contributors_unavailable__' key when the build-time
fetch produces zero successful results, and have PageContributors.tsx
detect that sentinel and skip its client-side API fallback entirely
instead of hammering the GitHub API per page.

Signed-off-by: castrojo <castrojo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant