Error when studying trpc

Hi I am new to this t3 stack and really like the idea of it but just tried to build a notes app but unfortunately got an error. Could someone please help me out and let me know where I got it wrong? https://github.com/GeroWalther/notes_trpc
GitHub
GitHub - GeroWalther/notes_trpc: next.js project to learn tropic
next.js project to learn tropic. Contribute to GeroWalther/notes_trpc development by creating an account on GitHub.
2 Replies
whatplan
whatplan2y ago
right now your optimistically updating using the current data with no changes, aka doing nothing your onMutate call back should take the new note you are adding as an argument and include that in what your optimistically setting your data to check out the rq docs: https://tanstack.com/query/v5/docs/react/guides/optimistic-updates#updating-a-list-of-todos-when-adding-a-new-todo
Optimistic Updates | TanStack Query Docs
React Query provides two ways to optimistically update your UI before a mutation has completed. You can either use the onMutate option to update your cache directly, or leverage the returned variables to update your UI from the useMutation result. Via the UI
Gero
GeroOP2y ago
I really appreciate it!! I will have a look at the react query docs and see if I can make it work like this. I made it working! Thanks!
Want results from more Discord servers?
Add your server