Type Alias: CartManagerStatus
CartManagerStatus = {
type:"idle"; } | {operation:CartManagerOperation;type:"loading"; } | {error:Error;operation:CartManagerOperation;type:"error"; } | {operation:CartManagerOperation;type:"success"; }
Tagged union of cart mutation lifecycle states. Lets callers do exhaustive switching without remembering which boolean flag pairs with which:
const { status } = useCartManager();
if (status.type === 'loading') return <Spinner label={status.operation} />;
if (status.type === 'error') return <ErrorBanner error={status.error} />;
// narrowed here: status.type ∈ { 'idle', 'success' }
idle is the initial state and the state after clearCart().