tomoS
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Or console.log everywhere to understand what’s happening 😅
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
That’s what I’ve been trying to say too ! lol
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
lol …
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
But isn’t he making a TRPC call and call backend to block the process before he returns value from onMutate? Thought that’s where the delay is from …
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Wld it make sense to run setTitle () under onMutate ?
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Where are you updating a state of recipieData? Can’t seem to find here
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Can I also c utils.recipie function?…
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Haha , I’m not react query wizard either so idk either …
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Ok.. doesn’t async await just defeat the purpose of onMutate? You don’t want to block any process with await but just to run the process as fast as it can..?
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
What’s this await call? That’s blocking for sure, and you are getting prevRecipie from backend . Probably better to hold that state within the component ..?
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
It looks like you can use this same pattern? Instead of onSuccese, update the state onMutate and validate the state again onSettled and re-render ui if it failed
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Right so it is optimistic update then .
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
It looks quite snappy to me … 😅
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
When you say slow, is it like a few seconds for 300ms+?
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Looks good to me ..
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Right… have you checked if you are making a connection every time you make a call?
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Got you, what is your backend? Assuming you are using prisma and calling planescale or sth?
174 replies
TTCTheo's Typesafe Cult
•Created by SharpieMaster on 10/11/2023 in #questions
optimistic update for complex data structure
Need bit more details here … slow doing what ? Is it initial page load, anything that’s to do with making API calls, or just unreal when you click on buttons? I’m suspecting the last one, in that case it’s usually unnecessary re-rendering happening with useEffect or sth…
174 replies
TTCTheo's Typesafe Cult
•Created by Max on 9/18/2023 in #questions
anyone else think app directory is not worth?
I c, thank you for this! I’ll give it a try on the project.
21 replies
TTCTheo's Typesafe Cult
•Created by Max on 9/18/2023 in #questions
anyone else think app directory is not worth?
Are TRPC routers running on server but calls to the routes are made on the clients side with those solutions above since they all uses “use client”? So is it currently impossible to use TRPC to prefetch data and render html on server side in app dir ….?
21 replies