Add Error And Empty States
# Add Error and Empty States
## Recipe
- Category: Implementation
- Recommended mode: Agent Mode
- Risk level: Low to Medium
- Estimated scope: Small to Medium
## Purpose
Add clear, recoverable, and context-aware empty and error states to an existing Lovable feature without changing its core business behavior.
This recipe is specifically for state design and implementation. It focuses on distinguishing true emptiness from loading, permission denial, filtering, partial data, and failure. It also ensures that recovery actions are meaningful, authorized, and consistent with the existing product.
## Use When
- a page or component renders blank content
- errors are swallowed, generic, or only visible in the console
- loading, empty, and error states are conflated
- a list, dashboard, search, table, form, or detail view needs clearer state handling
- the user has no recovery path after failure
- filtered results and truly empty datasets look the same
- partial failures need to remain usable
- retry behavior is missing or unsafe
## Do Not Use When
- the underlying feature is functionally broken and needs debugging first
- the business rule for what counts as “empty” is undefined
- the task requires redesigning the entire feature
- the primary issue is authorization architecture
- the request is only about visual styling
- the data source or contract is still unstable
## Inputs
- `[TARGET]`: Route, page, component, or flow
- `[DATA_SOURCE]`: Query, API, loader, provider, or local state
- `[USER_GOAL]`: What the user is trying to accomplish
- `[CURRENT_STATES]`: Existing loading, empty, and error behavior
- `[EXPECTED_EMPTY_CASES]`: Legitimate empty scenarios
- `[EXPECTED_ERROR_CASES]`: Known failure scenarios
- `[RECOVERY_ACTIONS]`: Valid user recovery options
- `[PERMISSIONS]`: Role, tenant, ownership, or visibility rules
- `[DESIGN_CONSTRAINTS]`: Existing components, tone, layout, or content rules
- `[OUT_OF_SCOPE]`: Explicit exclusions
- `[VERIFICATION]`: Required checks or flows
## Promptwhen to use it
Community prompt sourced from the open-source GitHub repo ubin8/Lovable-Cookbook (MIT). A "Add Error And Empty States" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
productivitycommunitydeveloper
source
ubin8/Lovable-Cookbook · MIT
more in Productivity
Productivity✓ tested
Summarize a doc into decisions & actions
chief of staff who extracts what to DO, not just what was said
Productivity✓ tested
Draft a reply to a hard email
calm, direct communicator who de-escalates without caving
Productivity✓ tested
Turn a brain-dump into a weekly plan
planning coach who protects your focus, not just your calendar