Skip to content

fix: surface useLandingStats error and loading state in WhyChooseUs section (Closes #878) - #954

Open
waterWang wants to merge 1 commit into
Grainlify:mainfrom
waterWang:fix/landing-page-stats-error-loading-878
Open

fix: surface useLandingStats error and loading state in WhyChooseUs section (Closes #878)#954
waterWang wants to merge 1 commit into
Grainlify:mainfrom
waterWang:fix/landing-page-stats-error-loading-878

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Summary

The WhyChooseUs section only destructured display from useLandingStats(), silently ignoring the isLoading and error states. When the API was loading or failed, users saw em-dashes () with no visual feedback.

Changes

  1. WhyChooseUs now destructures isLoading and error alongside display
  2. Loading state: Shows animate-pulse skeleton placeholders for the Active Users and Projects Funded stats while the API request is in flight
  3. Error state: Shows a centered warning fallback with role="alert" when stats fail to load, with a user-friendly message
  4. Tests: Added 3 test cases for loading, error, and success states

Screenshots

  • Loading: The stats values are replaced by pulsing skeleton bars
  • Error: A warning icon with "Unable to load live statistics" message is shown
  • Success: Stats display normally (unchanged behavior)

Closes #878

…ection (Closes Grainlify#878)

The WhyChooseUs component only destructured `display` from
`useLandingStats()`, silently ignoring `isLoading` and `error`.

Changes:
- Destructure isLoading and error alongside display
- Show animate-pulse skeleton placeholders while stats load
- Show error fallback with alert role when stats fail to load
- Add test cases for loading, error, and success states

Fixes Grainlify#878
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.

LandingPage's WhyChooseUs stats never surface useLandingStats' error or loading state

1 participant