At most one global state manager
Why it matters
Fragmenting global state across Zustand and Jotai (or any two stores) means some components subscribe to one source of truth while others subscribe to another, and no selector sees the complete application state. Cross-store updates require manual synchronization that inevitably drifts, causing UI components to render stale data, race conditions on login/logout flows, and bugs that only reproduce when state transitions span both stores in a specific order.
Severity rationale
High because state fragmentation produces race conditions and stale renders that are expensive to reproduce and debug.
Remediation
Choose one store and move every piece of client state into it. Create a single entry point at src/store/index.ts and delete the secondary store module entirely once migration completes.
// src/store/index.ts
import { create } from 'zustand'
export const useStore = create((set) => ({
user: null,
setUser: (user) => set({ user }),
}))
Server-state libraries like TanStack Query are not in conflict and should remain alongside your chosen client store.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Multi-Session Drift Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-code-drift·automated