-
Notifications
You must be signed in to change notification settings - Fork 1
feat: show error state in admin pages when a query fails #4
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
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.tsx—useInventarioCentral()ignoreserrorruteria/app/(admin)/admin/productos/page.tsx—useProductos()ignoreserror- 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
- Create (or reuse if one exists) an
<ErrorMessage />component with a friendly message and a "Retry" button that callsrefetch(). - Add
errorhandling in each affected page following the pattern above. - 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).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request