Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[adoptium.net-2239] sometimes the contributor component is empty #2240

Merged
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
12 changes: 7 additions & 5 deletions src/hooks/useAdoptiumContributorsApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ async function fetchRandomContributor() {
let needToRefetch = false;
const ONE_MONTH_MS = 2592000000;

const wlsMaxContributors = `${repoToCheck}_max_contributors`;
const wlsFetchDate = `${repoToCheck}_fetch_date`;

if (window.localStorage) {
const maxContributorsStored =
window.localStorage.getItem('max_contributors');
const fetchDateStored = window.localStorage.getItem('fetch_date');
const maxContributorsStored = window.localStorage.getItem(wlsMaxContributors);
const fetchDateStored = window.localStorage.getItem(wlsFetchDate);

maxContributors = maxContributorsStored
? parseInt(maxContributorsStored, 10)
Expand All @@ -126,8 +128,8 @@ async function fetchRandomContributor() {
}

if (window.localStorage) {
window.localStorage.setItem('fetch_date', String(Date.now()));
window.localStorage.setItem('max_contributors', String(lastPage));
window.localStorage.setItem(wlsFetchDate, String(Date.now()));
window.localStorage.setItem(wlsMaxContributors, String(lastPage));
}

return contributor;
Expand Down