Rigrig
Rigrig
TTCTheo's Typesafe Cult
Created by Rigrig on 3/4/2024 in #questions
Enabling offline mode with the t3 stack
Setting up tanstack query network mode to offlineFirst was shared as an option in another similar thread https://tanstack.com/query/latest/docs/framework/react/guides/network-mode
3 replies
TTCTheo's Typesafe Cult
Created by Rigrig on 12/6/2023 in #questions
Help with type safe trpc fetch call
This is something else that seems to work ok.
const data = await response
.json()
.then((json) => rowSchema.array().parse(json));
return data;
const data = await response
.json()
.then((json) => rowSchema.array().parse(json));
return data;
i've also saw this implemented elsewhere but the t3 stack throws eslint error
const data = await response.json().then(rowSchema.array().parse(json)
return data
const data = await response.json().then(rowSchema.array().parse(json)
return data
Note: ChatGPT suggests that both uses of rowSchema.array() and .output(z.array(rowSchema)) are necessary as they validate types at different time - runtime or compile time. I don't quite understand the difference. Is this duplication something I just need to accept? I switched to tRPC to get the infered types and baked in validation
3 replies
TTCTheo's Typesafe Cult
Created by Rigrig on 11/5/2023 in #questions
Is anyone using the nextjs app router for their frontend and pages for trpc?
If I could do all my backend in pages and front end in app then that might be a band aid till Clerk provide some clear guidance how to get it all wired up properly
5 replies
TTCTheo's Typesafe Cult
Created by Rigrig on 11/5/2023 in #questions
Is anyone using the nextjs app router for their frontend and pages for trpc?
I like the app router and I'm using Clerk for auth. I'm struggling to make Clerk work with protectedPrecedures using the app router but they have great docs/turorials on how to do it with the pages router
5 replies