Where state lives: Pinia, server-state caching and query libraries, forms and validation, real-time sync, URL and persistence.
Pages
- PiniaSetup stores versus option stores, how Pinia works in Nuxt SSR, storeToRefs and the reactivity traps, plugins and persistence, testing with createTestingPinia, Pinia 4, and when a store is the wrong tool.
- Server state and cachingTreating API data as a cache rather than state — stale-while-revalidate, keys and invalidation, optimistic updates with rollback, pagination and infinite queries — with useAsyncData, TanStack Query and Pinia Colada compared.
- Forms and validationOne schema for client and server with Standard Schema libraries, Nuxt UI's UForm, VeeValidate and FormKit compared, field components with defineModel, async validation, accessible error display, and mapping server errors back to fields.
- Realtime and syncWebSockets versus Server-Sent Events versus polling, Nitro's WebSocket and event-stream support, reconnection and resumption, keeping clients in sync with optimistic local state, and scaling realtime beyond one server.
- URL, cookies and browser persistenceThe URL as state, cookies for what the server render needs, localStorage and IndexedDB without hydration mismatches, versioned schemas, cross-tab sync, export/import, and the offline basics.
Notes for the whole section