Skip to content

feat(leaderboard): handle empty and partial states - #934

Merged
greatest0fallt1me merged 1 commit into
Predictify-org:mainfrom
Tekh134:feat/handle-leaderboard-empty-and-partial-states
Aug 30, 2026
Merged

feat(leaderboard): handle empty and partial states#934
greatest0fallt1me merged 1 commit into
Predictify-org:mainfrom
Tekh134:feat/handle-leaderboard-empty-and-partial-states

Conversation

@Tekh134

@Tekh134 Tekh134 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Handle leaderboard empty and partial states with production-ready loading, error, retry, stale, and permission state management.

Changes

  • Add LeaderboardLoadingState, LeaderboardErrorState, LeaderboardEmptyState, LeaderboardSkeleton components
  • Create useLeaderboard hook for managing loading, error, empty, stale, and retry states
  • Update LeaderboardSection to use the hook and handle all states with fallback data
  • Update LeaderboardTable to accept isLoading, error, onRetry props and render appropriate states
  • Fix sorting bugs (sortDescending undefined, scrollParentRef typo)
  • Update LeaderboardPodium to render empty state when opThree is empty
  • Update LeaderboardCards to handle loading, error, and empty states
  • Update YourRankChip to gracefully handle missing user data (user is optional)
  • Add comprehensive tests for all states and components

Compatibility

  • All existing props remain optional
  • Components default to current behavior when new state props aren't provided
  • No breaking changes to public interfaces

Security & Failure-Mode Handling

  • Error messages are sanitized to prevent sensitive data exposure
  • Retries are bounded with maxRetries to prevent infinite loops
  • Unmount-safe state updates prevent memory leaks
  • Stale data detection alerts the UI without blocking interaction

Test Coverage

  • hooks/tests/useLeaderboard.test.ts - Hook state machine tests
  • components/leaderboard/tests/leaderboard-states.test.ts - State component tests
  • components/leaderboard/tests/LeaderboardTable.test.ts - Table state and sort tests
  • components/leaderboard/tests/LeaderboardCards.test.ts - Cards empty/loading/error tests
  • components/leaderboard/tests/LeaderboardSection.test.ts - Section integration tests
  • components/leaderboard/tests/YourRankChip.test.ts - Chip missing user tests

Closes #898

- Add LeaderboardLoadingState, LeaderboardErrorState, LeaderboardEmptyState, LeaderboardSkeleton components
- Create useLeaderboard hook for managing loading, error, empty, stale, and retry states
- Update LeaderboardSection to use hook and handle all states with fallback data
- Update LeaderboardTable to accept isLoading, error, onRetry props and render appropriate states
- Fix sorting bugs (sortDescending undefined, scrollParentRef typo)
- Update LeaderboardPodium to render empty state when topThree is empty
- Update LeaderboardCards to handle loading, error, and empty states
- Update YourRankChip to gracefully handle missing user data (user is optional)
- Add comprehensive tests for all states and components

Closes Predictify-org#898
@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

@Tekh134 is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@Tekh134 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me
greatest0fallt1me merged commit 0dfe64a into Predictify-org:main Aug 30, 2026
1 check failed
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.

[Quality-2][High] Handle leaderboard empty and partial states

2 participants