Skip to content

Handle API loading, error, and empty states consistently (#367) - #417

Merged
dzekojohn4 merged 3 commits into
UnityChainxx:mainfrom
eulami:feat/api-loading-states
Aug 31, 2026
Merged

Handle API loading, error, and empty states consistently (#367)#417
dzekojohn4 merged 3 commits into
UnityChainxx:mainfrom
eulami:feat/api-loading-states

Conversation

@eulami

@eulami eulami commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Closes #367

…x#367)

Introduce shared patterns for frontend queries and mutations with retry,
cancellation, stale-data handling, and user-visible failure messages.

- useApiQuery: React Query wrapper with abort signal, exponential backoff
  retry (3 attempts), configurable stale/gc time, and disabled-by-default
  until enabled.
- useApiMutation: React Query mutation wrapper with retry, automatic cache
  invalidation on success, and extractErrorMessage for user-facing errors.
- StateDisplay components: LoadingState, ErrorState (with retry button),
  EmptyState, and composite ApiStateDisplay for consistent UI across pages.
- Refactored usePuzzleReviews to use useApiQuery/useApiMutation (queries
  keyed by filters+pagination, mutations invalidate reviews+stats).
- Refactored useReferral to use useApiQuery/useApiMutation (query keyed by
  userId, mutation invalidates referral cache).

Closes UnityChainxx#367

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@eulami Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@dzekojohn4 dzekojohn4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, merging in.

@dzekojohn4
dzekojohn4 merged commit b18b123 into UnityChainxx:main Aug 31, 2026
8 of 11 checks passed
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.

[P1][frontend] Handle API loading, error, and empty states consistently

2 participants