Skip to content

feat: show error state in admin pages when a query fails #4

@scldrn

Description

@scldrn

Context

Several admin panel pages consume React Query hooks but only destructure data and isLoading. When a query fails (network error, Supabase outage, expired token), the page silently renders empty — no feedback to the user whatsoever.

Affected pages

  • ruteria/app/(admin)/admin/inventario/page.tsxuseInventarioCentral() ignores error
  • ruteria/app/(admin)/admin/productos/page.tsxuseProductos() ignores error
  • Inventory tabs (colaboradoras, movimientos, valorizado)

Example

// Current — fails silently
const { data: items = [], isLoading } = useInventarioCentral()

// Correct
const { data: items = [], isLoading, error } = useInventarioCentral()
if (error) return <ErrorMessage error={error} />

Task

  1. Create (or reuse if one exists) an <ErrorMessage /> component with a friendly message and a "Retry" button that calls refetch().
  2. Add error handling in each affected page following the pattern above.
  3. Apply the same pattern to any (campo)/ pages that are also missing it.

Acceptance criteria

  • No admin page goes silently blank when its query fails.
  • The error component is visually consistent with the design system (navy + amber palette).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions