Skip to content

Senator List Fails to Load if Any Parallel API Call Errors #159

@calebyhan

Description

@calebyhan

Motivation

The contact form (/senators/contact) fetches senators, districts, and leadership data in a single Promise.all. If any one of those three calls fails (for example, if no leadership has been configured yet), the entire batch is aborted and the senator dropdown is never populated — leaving "Speaker of the Senate" as the only selectable recipient, with no error surfaced to the user.

Deliverables

  • Refactor frontend/src/app/senators/contact/page.tsx to fetch senators, districts, and leadership independently (e.g. via Promise.allSettled or separate try/catch blocks) so that a failure in one does not block the others
  • The senator dropdown should populate correctly even if the leadership or districts API call fails

Important Notes

  • The speaker shown in the dropdown is looked up from the leadership API; if that call fails independently, the speaker label should gracefully fall back to the generic "Speaker of the Senate" text already present in the UI

Metadata

Metadata

Assignees

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