Zustand Middleware Execution Timing versus React Automatic Batching: Pre‑process or Post‑process?
Goal: Decide whether Zustand middleware should execute as a pre‑process step (before the store’s internal state is mutated) or as a post‑process step (after state is set but before subscribers are notified) to align with React 18’s automatic batching and avoid unnecessary re‑renders. Uncertainty: The current implementation wraps setState and runs middleware