Skip to content

Airdrop: fix participant count using total from API, not entries.length #1040

@realproject7

Description

@realproject7

Bug

PR #1039 moved the participant count from CampaignHero to Leaderboard, but changed the data source from `totalParticipants` (status API) to `data.entries.length` (leaderboard entries). The leaderboard only returns top 50 entries, so this will underreport once there are more than 50 participants.

File: `src/components/airdrop/Leaderboard.tsx`

Current (buggy):
```tsx

{data.entries.length} {data.entries.length === 1 ? "participant" : "participants"}
\`\`\`

Fix

Option A: Add `totalParticipants` to the leaderboard API response (it already computes `pointsByAddress.size` — just include it).

Option B: Fetch `/api/airdrop/status` in the Leaderboard component and use `totalParticipants`.

Option A is cleaner since the data is already available in the leaderboard endpoint.

API change (leaderboard/route.ts)

Return `totalParticipants: pointsByAddress.size` alongside `entries` and `userRank`.

Component change (Leaderboard.tsx)

Use `data.totalParticipants` instead of `data.entries.length`.

Acceptance Criteria

  • Leaderboard API returns `totalParticipants` count
  • Leaderboard component displays actual total, not capped at 50

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions