Skip to content

bug: invite form stays stuck when referral invite request fails #131

@absalonCRC

Description

@absalonCRC

Summary

The Invite Friends form sets sending before posting to /api/referrals, then assumes both the request and res.json() succeed. If the network request rejects or the server returns a non-JSON error body, the handler throws before resetting sending, leaving the button stuck in "Sending..." and no useful error message shown.

Steps to reproduce

  1. Open /dashboard/referrals.
  2. Enter an email address.
  3. Make POST /api/referrals fail at the network layer, or return an invalid/non-JSON error response.
  4. Click Send Invites.

Expected

The page should recover, re-enable the Send Invites button, and show a clear error.

Actual

The unhandled failure path can leave the form stuck in the loading state.

Proposed fix

Wrap the invite POST flow in try/catch/finally, tolerate non-JSON error responses, and always reset sending.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions