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

Next.js Hydration error happening only in production.

There is a bug I've been trying to solve on the website I work at. There is one specific page that triggers an hydration error: https://reactjs.org/docs/error-decoder.html/?invariant=418 https://reactjs.org/docs/error-decoder.html/?invariant=425 The main issue is that it only happens in production. On top of that, it only triggers when I directly access the page, or refresh it. If I'm at the home page, for example, and navigate to the page that triggers this error, it will not happen....

Good case to use getServerSideProps instead of ISR

Hey everyone! I'm new to the next.js and i'm trying to figure out when one should use getServerSideProps instead of ISR since it is not recomended. I guess it is only viable for pages that changes data constantly, like every second?...

Prisma schema delete many to many

Hi, I have some troubles deleting a many to many relationship / data. Currently it says: ``ts prisma:error Invalid prisma.templateTag.deleteMany()` invocation:...

Play audio inside a T3 app

Hi all! I would like to play a success sounds when the user completes a task. What I have been trying is this: import useSound from "use-sound"; import success from "../../public/sounds/fanfare.mp3";...

tRPC and querying data from external api

I am trying to set up the following this. User writes a text in the form. He presses the button, the button puts input into tRPC and does a query(or maybe a mutation?) to send a completion request to OpenAI API and returns a result from there. I take this result and display it in the new text format bellow the button. Right now I know I have realised it incorrectly as it is not working, but I have no idea how to solve this or what is the best practice. Maybe I shouldn't be using tRPC at all....

Unable to connect to Postgres DB with prisma

I just installed pgAdmin 4 and created a db, however once I run npx prisma migrate dev I get the error User 'johndoe' was denied access on the database 'db.public'. Here is my database_url: postgresql://user:password@localhost:5432/db?schema=public. I also made sure that special characters have been converted inside % signs. Am I doing something wrong? Is there a specific way I need to create the database? Please help, thankyou.

Setting up WS with t3App

I'm following the TRPC repo by Katt, but I keep getting ENV vars being invalid when I run the WSS. This is the script, but it doesn't seem to work ```js...

What are the best ways to use TRPC procedures in getStaticProps ?

I wanted to know how can I use procedures made on my router from getStaticProps method

getting data from TRPC vs Zustand store

I need my component to prioritize data from a zustand store. If there's no data in the store, then fetch it from the server. I'm not sure if this is the correct way to do it? Curious if this the best way to check if there's data in a Zustand store vs fetching and setting the data? ``` const fetchRequestedProduct =...

Serverless and price of DDoS attacks

There's one thing in serverless that I'm not able to figure out: as far as I know if you suffer a DDoS attack in AWS then you have to pay for all the usage that the DDoS attack has caused, which can get very pricey. Other non-serverless hosting companies dont have this issue: if you suffer a DDoS attack you dont get charged an extra amount. Does that simply not exist in serverless? How do you tackle DDoS attacks for your apps in serverless? A rate limiter wouldnt be enough, right?...

How do I redraw DOM elements in a react component?

The page is the parent component and their children are the cells.

States don't update after Post

I'm having to manually invalidate the cache after every post in order for the states to update with the new data, but I feel like this shouldn't be happening. Am I doing something wrong?

Why is my prisma model typed as any?

added pictures. Basically I'm just trying to query my db after I pushed the models to the db with 'npx prisma db push'. I am using a Supabase so its a postresql db....
No description

background gradient shapes

Maybe a weird question but do you know place to get free shapes like this that tailwind ui uses https://keynote.tailwindui.com/...

Objects of objects of a certain type

I am trying to create an object whose keys can be anything, but values are of a certain type. Each object is essentially a link, that has a certain shape. Then I put them in a wrapper object like this, however each object within is typed indivdually instead of the overall object. The problem is when I try and loop over the wrapper object LINKS, it is not giving me typesaftey. How do i fix this?...

running npm script from within npm script fails with ESM error

here are the scripts from my package.json: ``` "scripts": { "build": "next build", "dev": "next dev",...

Best resource for hiring a T3 Developer

I have been developing my application for awhile now and I'm reaching a point where I am unable to create some of the complex trpc mutations that I need. I have never hired a developer before so I have a few questions about this. 1. Developer websites What websites do you guys use for finding reliable developers for technologies used in the T3 stack? I looked on Upwork but I didn't see Prisma developer as a searchable skill. Some of what I need done involves Prisma but also involves recursive data structures. Are there any developer websites where I can search for experience in "recursive data structures" or something like this? ...

Does vitest have a global teardown function?

I would like to run some cleanup mode in vitest after ALL tests in every test module are done. Is there a way to do this? All of the module files seem to run in parallel.

Using Prisma types elsewhere

This might be a really silly question, Im sure the answer is super simple, I can't find the answer in docs though (thinking about it this is probably a more Typescript question).. I have this TRPC call which returns some data with multiple relations: const parts = trpc.partDetails.getAll.useQuery(); The type for parts.data is ...

Next.js i18n type safety

Does someone have any recommendations on how I can get a type safe setup for translations with Next.js (using pages and not app structure)