Skip to content

MaintainerDashboardPage's try/catch around fetchBounties is dead code — fetchBounties never throws, so statStatus can never actually become "error" #240

Closed

Description

@chonilius

src/app/dashboard/maintainer/page.tsx#MaintainerDashboardPage does:

let bounties: Bounty[] = [];
let statStatus: "loaded" | "error" = "loaded";

try {
  bounties = await fetchBounties(mockBounties);
} catch {
  statStatus = "error";
}

with a comment explaining the intent: "We wrap fetchBounties in a try/catch so that if
the fetch fails, the cards explicitly show 'Error loading data' rather than rendering
stale zeros or crashing the page render."

But src/lib/api.ts#fetchBounties already catches every failure internally and resolves
to the fallback argument instead of rejecting:

export async function fetchBounties(fallback: Bounty[]): Promise<Bounty[]> {
  try {
    const raw = await request<RawBounty[]>("/bounties");
    return raw.map(adaptBounty);
  } catch {
    return fallback;
  }
}

fetchBounties cannot throw under any circumstance this function's own implementation
allows — every branch either returns adapted live data or the fallback. This means the
catch block in MaintainerDashboardPage is unreachable dead code: statStatus is
"loaded" in literally every case, including when the live fetch silently failed and
fell back to mockBounties. The comment's stated intent — showing "Error loading data"
on a genuine backend failure — is never actually achieved; the maintainer dashboard has
no way to distinguish "live data" from "backend down, showing 5 hardcoded mock bounties"
at all, contrary to what the surrounding code visibly tries to do.

Suggested fix: either have fetchBounties (or a variant of it) surface failure
information the caller can act on instead of swallowing it entirely, or remove the
misleading try/catch and comment here since it currently does nothing.

Activity

  1. added
    bug
    very hard
    help wanted
    architecture
    on Aug 21, 2026
  2. added
    Stellar Wave
    on Aug 24, 2026
  3. boluwacodes commented on Aug 24, 2026

    @boluwacodes
    Contributor

    @boluwacodes has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi Maintainer, I’d like to express my interest in taking on this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @boluwacodes to this issue.

  4. Muyideen-js commented on Aug 24, 2026

    @Muyideen-js

    @Muyideen-js has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    I'd like to fix this dead code by having fetchBounties surface failure information, likely by returning a discriminated union like { status: "loaded" | "error"; data: Bounty[] } so MaintainerDashboardPage can properly set statStatus. I'd update the mockBounties fallback path in api.ts to return the error status and adjust the dashboard's rendering accordingly.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Muyideen-js to this issue.

  5. drips-wave commented on Aug 24, 2026

    @drips-wave

    Congratulations, @boluwacodes! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @boluwacodes: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  6. added a commit that references this issue on Aug 25, 2026
    6bbbe45
  7. drips-wave commented on Aug 25, 2026

    @drips-wave

    This issue has been completed by @boluwacodes as part of the Stellar Wave Program's 8th Wave 🥳

    😎 @boluwacodes: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  8. removed
    Stellar Wave
    on Oct 15, 2026
  9. added
    Stellar Wave
    on Oct 15, 2026
  10. removed
    Stellar Wave
    on Oct 15, 2026
  11. added
    Stellar Wave
    on Oct 15, 2026
  12. removed
    Stellar Wave
    on Oct 15, 2026
  13. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar Wavearchitecturebughelp wantedvery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions