What problem does it solve?
Prevents stale, mismatched, and unsafe client state by forcing every UI, form, authentication, and cached server value to have a single authoritative source, explicit lifecycle, and clear invalidation and reset rules.
Core Features & Use Cases
- State classification and ownership rules: Classifies server state, UI state, form state, authentication state, and persisted preferences, then assigns the correct storage and lifecycle without defaulting to a global store.
- Server-state freshness and cache policy: Defines staleTime, gcTime/cacheTime, invalidation triggers, and stale-data behavior for TanStack Query, SWR, or Apollo-like caching.
- Secure auth and permission synchronization: Ensures auth state is sourced from trusted server validation, revalidated on defined events, and completely cleared on logout (including user-specific caches and client storage).
- Optimistic updates with deterministic rollback: Requires optimistic state application plus rollback-on-failure semantics so rejected server writes never leave the UI permanently inconsistent.
- Privacy-aware persistence decisions: Documents when and how persisted client preferences may be stored, including expiry and clear-on-logout handling for user-identifying or sensitive items.
Quick Start
Ask for a state-management ownership plan that classifies your current frontend state into server, UI, form, auth, and persisted preference categories and outputs exact invalidation, rollback, and logout-clearing rules.