Skip to content

fix: show error message in MinistryCardGrid when API call fails#156

Open
Nitin23123 wants to merge 3 commits into
LDFLK:mainfrom
Nitin23123:fix/ministry-card-grid-error-handling
Open

fix: show error message in MinistryCardGrid when API call fails#156
Nitin23123 wants to merge 3 commits into
LDFLK:mainfrom
Nitin23123:fix/ministry-card-grid-error-handling

Conversation

@Nitin23123
Copy link
Copy Markdown

Problem

The highlights section in MinistryCardGrid used a binary condition to
show either data or a "Loading..." message. If the API call failed, users
would see "Loading Highlights..." indefinitely with no indication of what
went wrong.

The error value from useActivePortfolioList was available but never
used in the JSX.

Fixes #155

Solution

Added an error state check in the highlights ternary so users get a clear
failure message when the API call fails, rather than a stuck loading state.

Before: data ? <highlights> : <Loading...>
After: data ? <highlights> : error ? <error message> : <Loading...>

Changes

  • src/pages/OrganizationPage/components/MinistryCardGrid.jsx — added
    error branch to the highlights conditional render using error.main
    color from MUI theme for visual consistency

Testing

  • When API succeeds: highlights render as before
  • When API is pending: "Loading Highlights..." shown as before
  • When API fails: "Failed to load highlights. Please check your connection
    and try again." shown in error styling

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a user experience issue in the MinistryCardGrid component where API failures for loading highlights would result in an endless loading message. By introducing an explicit error state, users now receive clear feedback when data cannot be fetched, improving the application's robustness and usability.

Highlights

  • Error Handling: Implemented a new error state in the MinistryCardGrid component to display a user-friendly message when the API call for highlights fails, preventing an indefinite "Loading Highlights..." state.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an error message display in MinistryCardGrid.jsx when highlights fail to load. A suggestion was made to refactor the hardcoded error string into a constant for improved maintainability and future internationalization.

Comment thread src/pages/OrganizationPage/components/MinistryCardGrid.jsx Outdated
@Nitin23123
Copy link
Copy Markdown
Author

Thanks for the feedback! I've extracted the hardcoded string into a HIGHLIGHTS_LOAD_ERROR constant defined above the component. This makes it easier to manage and sets up a clean pattern for future i18n.

Comment thread src/pages/OrganizationPage/components/MinistryCardGrid.jsx Outdated
<Typography
sx={{
fontStyle: "italic",
color: "error.main",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
color: "error.main",
color: colors.textMuted,

for color consistency

Co-authored-by: Sehansi Perera <157481761+sehansi-9@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 1, 2026

CLA assistant check
All committers have signed the CLA.

@ChanukaUOJ
Copy link
Copy Markdown
Member

@Nitin23123 Can you sign the CLA.

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.

[BUG] MinistryCardGrid API error handling for highlights

4 participants