Appearance
State and Reactivity Management
These Accepted rules define how frontend state is owned, shared, initialized, and synchronized. The decisions apply across frameworks; Vue reactivity and Pinia are used as concrete examples, not as required tools.
Status
Accepted
Rules
| Rule | Scope |
|---|---|
| Keep UI state local by default | Local state ownership; Vue APIs shown as examples |
| Assign state to the lowest responsible owner | State ownership hierarchy and escalation criteria |
| Use a store for genuinely shared state | When independent consumers need one shared state lifecycle |
| Load store data lazily | Store initialization, loading triggers, and loaded-state semantics |
| Deduplicate shared store fetches | Cached results, concurrent requests, and retries |
| Separate stores from services | Reactive state lifecycle versus business/data operations |
Core Principle
Keep UI state with its narrowest responsible owner. Promote it to a shared store only when independent parts of the application need the same state or lifecycle. Load shared data when required and let its owner coordinate loading.
These rules complement the component management rules and the front-end application structure.