Theo's Typesafe Cult

TTC

Theo's Typesafe Cult

Join the community to ask questions about Theo's Typesafe Cult and get answers from other members.

Join

What to use to manage state in T3 stack app

I want to implement a cart function for my app and was wondering what state management library to use with my app. It is made with create-t3-app...

Mocked unit tests or Integration tests

When running tests in the frontend that involves a server side call, do you prefer to mock the server side call to do the unit tests or do you skip that and proceed with writing Integration/E2E tests?

useEffect deps for run on mount

given an effect you want to run on mount like: ``` const publish = () => {…} useEffect(() => {...

how to get vite-plugin-relay to work

hello. I'm trying to use this plugin as a last-mile build solution for the relay parts that need to be babel transformed, using clojurescript that was compiled using shadow-cljs into esm. I've been able to use this plugin with much success in the past but am finding it difficult for this one use case and was wondering what it is I'm overlooking since I'm getting this error when loading the site with vite `browser.js:1 Uncaught Invariant Violation: graphql: Unexpected invocation at runtime. Eithe...

How to add custom fonts in T3 app

is there a definitive way of doing this I've tried many ways but none of them work. I want to use poppins font from google fonts...

How to increase 1mb upload limit

Currently I have to call a mutation with trpc which passes an array with 1000+ elements using the t3 stack. Is there a way to increase the upload limit? Thanks!

RTK Query (with no redux) or React Query?

I'm a noob, obviously, but a bunch of my friend called me out for making api requests in useEffect and they recommended me to use RTK query instead. The problem is that I'm not planing on using redux in my project, since its way too small for that. So... should I go with RTK query (with no redux) or with React Query instead? Just please elaborate a bit because I want to understand why, not just blindly follow. Huge thanks <33...

Seperate or external back-end

Is it good having a seperate back-end using e.g. Django and communicating with api, or is it best practice for Next to use something like Prisma?

export default or...

Okay so this is pretty subtle but confusing. I've once Heard that for example
export default function Home()
export default function Home()
is considered bad practice. Why? If so how should I name my components to not bother about it ever again?...

tRPC queries&mutations really slow on Vercel+Planetscale deployment

Hello! I deployed my T3 app to vercel and the DB to Planetscale, and I am seeing some incredibly slow speeds on the queries/mutations for tRPC. Take this mutation for following a user for example: ```ts follow: authedProcedure .input(...

env schema.mjs reading values as number

Most of the times env vars are strings, so my schema definition of a value looks like NEXTAUTH_URL: z.string() for those vars. But if I want to read numeric values like a port, it seems I can't just do EMAIL_SERVER_PORT: z.number(). Do I generally have to read env vars as string-ish values, and have to parse them to numeric values in my code later on, or am I doing something wrong?...

How do you push schema changes to a dev branch with planetscale and prisma

How do you push schema changes to a dev branch with planetscale/prisma

Cannot use the same host twice in Next.js 13

On the left of the screenshot, I am fetching posts in a layout. On the right, I am streaming comments in. If I use the same host for comments as I did for posts (https://jsonplaceholder.typicode.com/comments), the page infinitely loads. If I switch it out for a different host (https://dummyjson.com/comments ), it works fine. I've checked the endpoint in the browser and it responds quickly every time...

When not to use tRPC?

If I'm building a mobile and/or a web app with React Native / NextJS (TS), is there any scenario you would advise people not to use tRPC? (We can assume all the clients are in the same repo as the server) Are there any current limitations or cons of tRPC that people should be aware of?...

Add Admin Role to T3 Stack

Hi, not sure what I'm missing for this in user Schema
role Role @default(USER)
role Role @default(USER)
and then the enum for Role.. thats okay,...

how to keep git history of two repos that are being added to new monorepo

is there a recommended practice around this? does it involve using submodules or just cloning them into the monorepo or something eelse?

trpc v10 (but not v9) stuck loading any query

disregard my post. It's working in my other laptop. Maybe related to my node version? no idea.

NextAuth authorizationParams not working

Hey guys, I wanted to pass an error param to the signin/signout page for nextauth but this doesn't seem to work... SignOut doesnt even support params it seems but signin should. Am I missing something here??
await signIn(undefined, undefined, "error=SessionRequired");
await signIn(undefined, undefined, "error=SessionRequired");
...

beginner golang resources

Any recommendations for how to get started with golang? I’m not too worried about syntax, more package management, how to set up a good dev environment, etc

Send default value along with form instead of empty string

I have a form that users should use to update their profile. The problem is when the user wants to change any field, it will only send the field that he changed, sending the rest as blank strings (see ss). The form uses a default value of the db entry. It appears fine on the frontend but i dont understand why it only picks the fields that i changed. I suspect it has something to do with react-form-hook only registering the changed components. I tried adding a default value to the react-form-hook...