Skip to content

Commit ba7197b

Browse files
committed
Improve error handling and logging for leaderboard data fetching
1 parent 5434ddb commit ba7197b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/pages/dashboard/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,13 @@ const DashboardContent: React.FC = () => {
266266
setLeaderboardError(null);
267267

268268
try {
269-
console.log('🔄 Fetching leaderboard data from RecodeHive GitHub API...');
270269

270+
271+
console.log('🔄 Fetching leaderboard data from RecodeHive GitHub API...');
272+
271273
// Fetch all repositories from RecodeHive organization
272274
const reposResponse = await fetch('https://api.github.com/orgs/recodehive/repos?type=public&per_page=100');
273-
275+
274276
if (!reposResponse.ok) {
275277
if (reposResponse.status === 403) {
276278
console.warn('GitHub API rate limit exceeded. Using fallback data.');
@@ -406,8 +408,13 @@ const DashboardContent: React.FC = () => {
406408
// );
407409
setLeaderboardData(transformedData);
408410
} catch (error) {
409-
console.error('❌ Error fetching RecodeHive contributors data:', error);
411+
console.error("❌ Error fetching RecodeHive contributors data:", error);
410412
setLeaderboardError(error.message);
413+
414+
// Load fallback demo data
415+
console.log("📝 Loading demo data as fallback...");
416+
console.warn('Using fallback leaderboard data due to GitHub API limitations');
417+
setLeaderboardError('GitHub API rate limit reached. Showing demo data.');
411418

412419
// Fallback demo data with similar structure
413420
console.log('📝 Loading demo data as fallback...');

0 commit comments

Comments
 (0)