Gabriel
Explore posts from serversHow can I automatically use react's cache with tRPC on server side?
I have this in my repo:
But, now I need to understand, how should I export the actual functions from the api caller so they are all cached with react's cache?
I of course could do something like this
But I would prefer if I could get an instance of api where all of my endpoints will be using the cache automatically. something like
2 replies
Why deprecate experimental_standaloneMiddleware?
I am reading https://trpc.io/docs/server/middlewares#experimental-standalone-middlewares, but it's still not clear to me why experimental_standaloneMiddleware was deprecated. It says we can use .concat() to use "standalone" middlewares. However, I don't see how they are related exactly?
The example shows we can use a plugin. This would take in a new procedure to do concating of procedures.
But this is not exactly what I want. In my code I have this:
Doing this via concat() feels unnatural. I just want to define a middleware that I can use in multiple procedures where my session is not null (protected context). What is the recommended way of doing this?
5 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 10/8/2023 in #questions
How to add Prisma Client extensions to create-t3-app?
3 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 10/2/2023 in #questions
What are these Typescript completion suggestions inside Prisma?
2 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 9/23/2023 in #questions
Prisma deleting wrong table?? WHY
Ok, here's what I want to do: I want to delete a EventMaster that is linked to a certain EventException. Here's my query:
FOR SOME REASON, this is deleting my EventException and not my EventMaster. I don't know why... this is scaring me because the query looks solid to me. I do have setup cascade deletes on my EventException, because I do want prisma to delete my
EventException
after I delete the EventMaster
. However, it is not deleting the master at all and only the EventException.
WHy is this happening?2 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 8/28/2023 in #questions
Help in Nextauth EmailProvider
I am getting this strange error in emailProvider for nextauth. Does anyone know what I am doing wrong?
13 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 8/15/2023 in #questions
How do I make Next App dir only run a function once? (Like getStaticProps)
Hi, I have a function called
getLocalDevURL
, but I can't seem to get it to properly run only once on the server, at build time. I am building an utility to generate a QR code, and for that I need to make getLocalDevURL
run only once.
7 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 7/22/2023 in #questions
What is prefetching in TRPC server side?
I was able to create a TRPC server helper with "createServerSideHelpers". I am using it in my server function like this:
But I don't understand what it is doing. The docs say it does not return anything and never throws. I tried importing "Client" that is actually a Client component to see how it behaves:
I thought it would somehow have sent the data into the ReactQuery as initialData or something, but it always fetches right when the Client component is mounted. I don't understand what prefetching does. Can someone explain
10 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 7/22/2023 in #questions
Correct way to fetch data in a server component and pass it to a client component? ReactQuery TRPC
Hi, I want to understand what are the best practices to deal with TRPC and react server components. Say that I want to have a server component that fetches data in the backend using trpc.
I understand that if I am in the server I should use createCaller method from trpc. I tried to do it like so, and pass the data I fetch from the caller to my client component:
3 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 7/18/2023 in #questions
Can I still get features like SSR/ISR with this infrastructure?
21 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 7/17/2023 in #questions
Feedback for my infrastructure needed!
11 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 7/13/2023 in #questions
How can I use a TurboRepo to have multiple Apps? Do I use multiple Next.JS projects? Help with infra
13 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 5/9/2023 in #questions
Is there a onRegister handler for NextAuth?
Hi folks, how would you go about creating a onRegister function on NextAuth for new users?
Their documentation does not have this, I don't know why.
I want to generate some data on DB whenever a new user is logged in for the very first time
5 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 5/3/2023 in #questions
Help with Vercel deployment
3 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 5/2/2023 in #questions
How do I set the default useState value of a trpc call?
12 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 2/28/2023 in #questions
Help, how do I do this?
5 replies
TTCTheo's Typesafe Cult
•Created by Gabriel on 2/23/2023 in #questions
Debugging TRPC issues?
9 replies