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

Optimize Images (T3 Stack + S3 + CloudFront)

How would you go about optimizing images? Right now I'm just fetching each link from S3 and then map through the links array and use that as src (example: https://jibberish.cloudfront.com/${link}) (i'm using next/image but that's slow when loading, like really slow) I'm begginer/intermediate so try and explain thoroughly....

trpc v10 Invalidating all queries from given router

Is it possible to invalidate all the queries under given router? Similarly as it is in react-query: https://tanstack.com/query/v4/docs/guides/query-invalidation Can I use query-client in trpc in the same way?...

Prisma Update many WHERE with LIMIT?

Got a table full of records that can be assigned to a user, by default they have no user assigned to them. I would like to run something like the following to make sure only X amount of records can be assigned at once. UPDATE"verificaiton SET userID = ${userId} WHERE verificaitonSessionId IS NULL LIMIT ${input.limit} i cant believe that prisma does not allow this? Im i going mad? https://github.com/prisma/prisma/issues/8359v...

.env variables failed to load

I want to fill my Railway Postgres database with data which I have locally. I have followed nexxel's create-t3-app tut to create a database added all the env variables but this is happening.

nextauth session props problem

Hey Guys I have code like that `const MyApp: AppType = ({ Component, pageProps: { session, ...pageProps }, }) => { return (...

How to Pass (Dynamic) Variables in trpc.useQuery()?

I know I can do this: const findSubscriber = trpc.useQuery(["subscriber.find", { email: "elsa@prisma.io" }]); But what if I want the user to type in an email & then see if that email exists with subscriber.find ? So I want to execute my query conditionally, that is, only in an onClick, as I don't have the user input before that....

how do you add `prettier-plugin-tailwindcss` to an existing ct3a app?

ive installed the plugin (pnpm add -D prettier prettier-plugin-tailwindcss). docs say plugins aren't automatically used from node_modules with yarn or pnpm, so need to make a prettier.config.js, but eslint doesn't like that:
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: prettier.config.js. The file must be included in at least one of the projects provided....

_app

Stale Environment Varaibles. Hey everyone, I had a quick question about stale environment variables when using CT3A. For some reason when I update my .env file it seems like I have stale variables and the updates don't take effect. I tested this with printenv and it seems my current work around is to - remove yarn.lock - remove node_modules...

Typescript Function to make specific nested keys non nullable?

Does anyone know of a Typescript Function to make a bunch of provided nested keys non-nullable? Sometimes I want to reuse a GQL type but want to remove a bunch of nulls/undefined from nested keys. E.g. ```ts type User = {...

how do I send complex criteria in a get request?

I have this db where I need to fetch a certain data from a certain table, and I want that data to be filtered depending on the client's needs. and the filtration goes like this. ```js const body = { props: ['title', 'id', 'qrCode'],...

Requirements to start with t3

I just joined so hi everyone :). I was very interested in Theo's videos and would like to build something using create-t3. I'm a full-time React developer, but only with a year of pro experience and unfortunately I don't have much knowledge about backend, databases and the like. Before delving into next.js / prisma and so on, do you suggest learning node.js and some databases first? Maybe something more? If so I would appreciate suggestions. It seems to me that I should do so, but maybe I'm wrong. Sorry if this is a "stupid" question, have a nice day...

Tool to find unused functions

Is there a tool to find unused function in a node codebase?

Many-to-many relationship in SQL as table or JSONB array?

Hi! I'm new to SQL and I'm wondering which way to model data makes more sense. I want queries to be performant, yet I don't want to over-engineer. My database is PostgreSQL in Supabase. I'm modeling players and games where each player can be in many games and each game can have many players — so a many-to-many relationship. I've enabled Row Level Security so a player only has access to the games that they participate in....

Why typescript type inference is behaving like this?

Screenshot 1: Does not work! Screenshot 2: Works!! 😵‍💫...

How would you run something like eslint locally? (contributing)

So I'm wanting to contribute to eslint_d but I have no clue how to run it locally. How do you test your local changes that you want to attempt to make with a package like this?

Is MongoDB Atlas killing my company?

In a recent video about hosting solutions, Theo reluctantly added Atlas as an option for database hosting. Saying: "Guys, I'm looking for hosting solutions, not ways to kill your company" Now as someone who has a company and uses Atlas I'm rather curious where the resentment is coming from....

Proper use of useEffect with KeyboardEvent eventListener

If there is state in my onKeyDown function which is set in document.addEventListener("keydown", onKeyDown), how would i keep my state within onKeyDown from getting stale? Should it be added as a dependency in my useEffect? For example: ```useEffect(() => { document.addEventListener("keydown", onKeyDown);...

writing tests for trpc

i am aware of theo's stance on tests, but we really need them we're building a payment gateway can't fuck with money. how do we write tests for trpc, couldn't find anything in the docs