Optimistic updates not working?
Does anyone have a working code snippet using the latest create t3?
2 Replies
Include the code here and someone will might be able to see whats wrong. There are examples on the react query docs on setting up optimistic updates, you can do the same with trpc. https://tanstack.com/query/latest/docs/react/guides/optimistic-updates
Optimistic Updates | TanStack Query Docs
When you optimistically update your state before performing a mutation, there is a chance that the mutation will fail. In most of these failure cases, you can just trigger a refetch for your optimistic queries to revert them to their true server state. In some circumstances though, refetching may not work correctly and the mutation error could ...
exmaple for a todo app