What problem does it solve?
Enforces initialization, provider, and data-fetching rules for the app shell, layout, and global provider tree. Use when working on app/Providers.tsx, app/DeferredSingletons.tsx, any layout.tsx, any provider file, any context that wraps children globally, StoreProvider, or when adding new providers, data-fetching to the startup path, or useEffect calls that run on mount in upper-level components. Also use when someone references Redux user state, auth checks, isAdmin, isGuest, or fingerprintId on the client side.
Core Features & Use Cases
- Empty-shell pattern: mount providers as zero-cost shells and expose an idempotent initialize() to trigger data loading on demand.
- Duplicate-provider guard: ensure a single provider instance in the global tree; call initialize() only from the existing context.
- Redux-first guidance: migrate legacy contexts to Redux where feasible and document exceptions.
- Client-side auth safeguards: avoid client-side Supabase auth calls; use server-side or Redux selectors for user identity.
Quick Start
Refactor your app’s providers to mount as empty shells with an idempotent initialize() and trigger initialization only when data is actually required.