Analyze and fix unnecessary useState, derived state, and server-state-in-local-state anti-patterns
Arguments:
User arguments: $ARGUMENTS
This codebase uses React Query for all server state and Zustand for client-only global state. useState should only be used for ephemeral UI concerns (open/closed, hover, local form input). Server data should never be copied into useState or Zustand — React Query is the single source of truth.
Read these before analyzing:
useState + useEffect to sync React Query data into local state. Use query data directly. The only exception is forms where users edit server data.useState(prop) + useEffect(() => setState(prop)). Use the prop directly, or use a key to reset component state.selectedId not a copy of the selected object. Derive the object: items.find(i => i.id === selectedId).