Spark
Spark
Explore posts from servers
TtRPC
Created by Spark on 8/31/2024 in #❓-help
calling tRPC procedure from custom link
what is the best way to call a procedure from a custom link? I see in https://github.com/pyncz/trpc-refresh-token-link they are using a helper client. I tried the proxy client approach with await utils.client.auth.refresh.mutate(tokens), but getting Error: Unable to find tRPC Context. Did you forget to wrap your App inside withTRPC HoC?.
4 replies
TtRPC
Created by Spark on 7/2/2024 in #❓-help
tRPC deployed with Amazon API Gateway adapter, SST Ion, and Clerk auth
I am going through this https://ion.sst.dev/docs/start/aws/trpc/, but I don't know the best way to pass auth() from server Next.js to awsLambdaRequestHandler.
return createTRPCContext({
event: ? // pass event.headers: heads?
auth: auth(), // can't do this. idk best way to pass this through to awsLambdaRequestHandler and handle it
});
return createTRPCContext({
event: ? // pass event.headers: heads?
auth: auth(), // can't do this. idk best way to pass this through to awsLambdaRequestHandler and handle it
});
I am doing
headers.set("Authorization", `Bearer ${authToken}`);
headers.set("Authorization", `Bearer ${authToken}`);
for Expo and that is working fine.
2 replies
TtRPC
Created by Spark on 1/30/2024 in #❓-help
optimistic updates tRPC v11 + TanStack Query v5
I am reading https://tanstack.com/query/latest/docs/framework/react/guides/optimistic-updates#if-the-mutation-and-the-query-dont-live-in-the-same-component and I am a bit confused on the best way to implement the optimistic updates 'Via the UI'. How would I access variables from useMutationState?
3 replies
TTCTheo's Typesafe Cult
Created by Spark on 1/30/2024 in #questions
optimistic updates tRPC v11 + TanStack Query v5
I am reading https://tanstack.com/query/latest/docs/framework/react/guides/optimistic-updates#if-the-mutation-and-the-query-dont-live-in-the-same-component and I am a bit confused on the best way to implement the optimistic updates 'Via the UI'. How would I access variables from useMutationState?
2 replies
TTCTheo's Typesafe Cult
Created by Spark on 1/24/2024 in #questions
how would I use validators from drizzle-zod in expo?
I am reading this on the create-t3-turbo README:
Does this pattern leak backend code to my client applications?
No, it does not. The api package should only be a production dependency in the Next.js application where it's served. The Expo app, and all other apps you may add in the future, should only add the api package as a dev dependency. This lets you have full typesafety in your client applications, while keeping your backend code safe.

If you need to share runtime code between the client and server, such as input validation schemas, you can create a separate shared package for this and import it on both sides.
Does this pattern leak backend code to my client applications?
No, it does not. The api package should only be a production dependency in the Next.js application where it's served. The Expo app, and all other apps you may add in the future, should only add the api package as a dev dependency. This lets you have full typesafety in your client applications, while keeping your backend code safe.

If you need to share runtime code between the client and server, such as input validation schemas, you can create a separate shared package for this and import it on both sides.
Currently, I am referencing the OpenStatus repo where they create the validation schemas in the db package https://github.com/openstatusHQ/openstatus/blob/main/packages/db/src/schema/users/validation.ts. How would I use these in expo if I cannot have @acme/db as a dependency? Do I have to manually create the validators in the validators package and only use drizzle-zod in Next.js?
2 replies
TTCTheo's Typesafe Cult
Created by Spark on 1/7/2024 in #questions
trying to integrate solito in create-t3-turbo
I am having a bit of trouble converting create-t3-turbo into a solito project. Has anyone had success, or does anybody want to help? Here is the repo: https://github.com/trevorpfiz/nourish.run I will share my progress here as I continue.
7 replies