Skip to content

TanStack Query: Write Path

The "Write" path shifts from a manual SyncQueue to Mutations with Optimistic Updates.

Instead of writing to DB first, we update the UI immediately (Optimistic) and then try the network. If the network fails, TanStack Query handles the retry or rollback.

Note on Offline Persistence: Standard useMutation does not persist across page reloads by default. To match the current system's robustness, we would use the Experimental PersistMutationCache or a custom Service Worker queue. This diagram assumes the standard "Robust Online + Offline Cache" model.