Skip to content

fix: bypass Next.js fetch cache for GitHub contributions API#113

Open
TanayJalan wants to merge 1 commit into
srizzon:mainfrom
TanayJalan:fix-contribution-cache
Open

fix: bypass Next.js fetch cache for GitHub contributions API#113
TanayJalan wants to merge 1 commit into
srizzon:mainfrom
TanayJalan:fix-contribution-cache

Conversation

@TanayJalan

Copy link
Copy Markdown
Contributor

What this PR does

This PR fixes an issue where the user's GitHub contribution count would remain stale even after using the Loadout refresh functionality or returning to GitCity later.

Root Cause

By default, Next.js (App Router) aggressively caches fetch requests across the server, including POST requests to external APIs like the GitHub GraphQL API. Because of this, the background refresh job (refreshDeveloper) was continually receiving and saving the exact same cached contribution data from the user's initial login, rather than hitting GitHub's servers for fresh data.

Solution

  • Added cache: "no-store" to the fetch call for https://api.github.com/graphql in src/lib/github-api.ts.
  • Added cache: "no-store" to the repository list fetch calls in src/lib/github-api.ts and src/app/api/dev/[username]/route.ts to ensure users' repository stats are also kept strictly up to date.

This forces Next.js to bypass its internal data cache, ensuring GitCity successfully retrieves the latest GitHub data on every background refresh.

Closes #112

@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

@TanayJalan is attempting to deploy a commit to the Samuel's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

[Bug] GitHub Contributions Not Refreshing After Loadout

1 participant