react-ui-patterns

Audit React components for loading, error, empty, and button-state issues.

7|2|Updated Jun 30, 2025
One-click install
npx skills add https://github.com/hq-opensource/predictive-control --skill react-ui-patterns-hq-opensource
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-ui-patterns
Source: https://github.com/hq-opensource/predictive-control/tree/main/.agent/skills/react-ui-patterns
Command: npx skills add https://github.com/hq-opensource/predictive-control --skill react-ui-patterns-hq-opensource

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill establishes deterministic UI behavior by eliminating stale interfaces, flashing loading spinners when cached data exists, and silently swallowed errors during asynchronous data fetching and mutations.

Core Features & Use Cases

  • Loading State Patterns: Show loading only when no data exists, prefer skeletons for known content shapes, and avoid spinners that flash on refetch.
  • Error Handling: Surface inline, toast, banner, or full-screen errors with retry options and ensure mutations include explicit onError handlers.
  • State Management: Provide empty-state requirements, optimistic updates, progressive disclosure, graceful degradation, and button state rules (disable during async operations and show loading indicators).
  • Use cases include list and collection views, form submissions with server-side validation, GraphQL queries and mutations, and any component that requires clear user feedback during async operations.

Quick Start

Use the react-ui-patterns skill to audit a React component and provide concrete recommendations to fix loading, error, empty, and button-state issues.

Frequently Asked Questions about react-ui-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stop stale UI and flashing loaders during React data fetching?

To stop stale UI and flashing loaders during React data fetching, apply conditional loading indicators that only show when no cached data exists. Use skeleton loaders for known content shapes to prevent spinners from flashing on background refetches.

What is the best way to handle error states in React GraphQL mutations?

The best way to handle error states in React GraphQL mutations is to ensure mutations include explicit onError handlers. Surface errors inline, via toast, banner, or full-screen components, and always provide retry options for failed operations.

How do I implement optimistic updates in React form submissions?

Implement optimistic updates in React form submissions by immediately updating the UI to reflect the expected state before the server responds. Disable submit buttons and show loading indicators during the async operation to prevent duplicate requests.

When should I use empty-state handling in React list and collection views?

Use empty-state handling in React list and collection views when data fetching returns zero records. Providing explicit empty-state requirements ensures graceful degradation and clear user feedback instead of rendering blank screens.

Does this UI pattern approach work with standard React form and GraphQL libraries?

Yes, this UI pattern approach works with standard React form and GraphQL libraries by providing integration guidelines for asynchronous data flows. It applies to frontend React applications handling data fetching, GraphQL mutations, and form submissions.

Why do my React components silently swallow errors during asynchronous operations?

React components silently swallow errors during asynchronous operations when mutations lack explicit onError handlers. Establish deterministic UI behavior by enforcing explicit error surfaces with retry options for all GraphQL queries and form submissions.