Status: Accepted Date: 2026-03-24
The LearnVault frontend needs to handle complex asynchronous states (fetching Stellar account balances, course progress, and weather data) alongside simple global UI states (theme, user session). We evaluated Redux, Zustand, and TanStack Query.
We have selected TanStack Query for server-state (API/Blockchain data) and Zustand for the remaining lightweight global client-state.
- Automatic Caching: TanStack Query handles the "stale-while-revalidate" logic for blockchain data out of the box, reducing unnecessary RPC calls to Soroban nodes.
- Boilerplate Reduction: Zustand provides a much cleaner, hook-based API compared to Redux, which is critical for maintaining our Next.js frontend.
- Developer Experience: Clear separation between "data from the server" and "local UI state" makes the codebase easier to navigate for new contributors.
- Learning Curve: New contributors must understand two different state paradigms (Query vs Store).
- Bundle Size: Adding two libraries instead of one, though both are significantly smaller than the Redux ecosystem.