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

Will server components be refeteched on mutation?

If I have a page using the server trpc and then a client component that updates the list, will the server trpc call be refreshed?

Nextjs parallel routing questions

I have this routing setup right, ```bash { (main) { about {}...
Solution:
Yes

How can I subscribe to updates in an RSS feed?

I want to subscribe to changes on a shopify store’s RSS feed for their products. It seems extremely compute intensive to fetch the rss url every second or even every hour. I know RSS feeds are meant to be subscribed to so how can I make it so that I can get a trigger and update data in my database whenever the rss feed changes? Essentially how does feedly work under the hood? Ofc I can’t use feedly itself since I need to update my db based on updates in the rss feed...

How can I configure tRPC to function as a REST API (single-route)?

I'm new to tRPC and not sure why this produces an error when an external POST request is sent to the /api/trpc/post.createExternal route. I'm trying to expose a tRPC route / procedure, so that an external service can POST to it Example POST ...

T3 Stack: tRPC not extending type definitions to client

Hey, I'm currently trying to work on getting my 'next build' script to work and ran into a bunch of issues when I'm using data from tRPC calls. The variables I'm saving the data under are not receiving the type inference benefits that I thought I would be getting with tRPC but instead being set to any type. To try and resolve this I looked into the tRPC docs and saw that you can use your root appRouter to create type inference from the subroute calls you make so I set about adding that to my ap...
No description

Total noob! Supabase and the t3 stack

Im really struggling with configuring my create-t3-app with supabase. Can anyone point me in the direction of a guild to help me though it?

How to exclude specific routes from Clerk middleware?

Anyone know how I can exclude the middleware from Clerk from running on my routes in folder: /api/cron? Here's the current file: ```TypeScript import { authMiddleware } from "@clerk/nextjs";...

For Sr+ Engineers: Frontend, Backend, or Full-stack?

For the engineers that have been around a while, been successful in what they started with, and started to get more opportunities. How did you navigate yourself through what you wanted to get better at as your career progressed? For example: I know some engineers who start in UI and then be moved to the backend because either that business' harder problems are in the backend and/or the manager thinks that is where the harder problems lie. (Seems to be an anitiquated belief amongst older tech managers that backend is inherently harder) Or: You start on either end of the stack and move to being more "full stack" to make yourself theoretically more flexible and definitely more valuable to smaller companies that need breadth more than they need depth....

It works locally but doesn't save to the database when deployed on Vercel.

It's working fine on my local machine, but after deploying to Vercel, it's not saving data to the database.

Error on NextJs AppRouter

Anyone knows why this is showing on my console?
No description

useFormState in tables, or complex forms

I decided to play with the new server components and useFormState. I am building myself the table shown in the image, and the table row code. I want each row to be managed separately, meaning that the user can save, delete or edit the row. Unfortunately, because it's a table, I can't wrap the entire row in the <form> element due to hydration errors. Error: Warning: Expected server HTML to contain a matching <tr> in <form> and so on... Is there any way to get into these fields that I don't know about, or is useFormState intended for simple login/password type forms? By the way, I think it has a lot of limitations, such as what I wrote, or the lack of client-side validation...
No description

How are signals going to be any different that state variables in React?

I was just watching Theo's videos on signals coming to javascript (https://www.youtube.com/watch?v=JvE_xQVIFF0) and I'm a little confused. I get that this will be there for all of javascript but still would this impact React or similar state-ful libraries/frameworks in any way. I mean, we already have these features in these that's the whole point of them being state-ful. Can somebody please explain what I'm missing here ?
Solution:
Yes, exactly, react already has a way of doing it but it's not standardized in any way. These signals would be standardized for the whole browser platform

Next redirect() gives date.getTime() error

I use lucia auth with nextjs. And all things are okay until i add redirect('/blog/login') fuction into my code. then even if i had session cookie in my browser i get error about ```TypeError: date.getTime is not a function. (In 'date.getTime()', 'date.getTime' is undefined) at isWithinExpirationDate (:40:37) at <anonymous> (:76:74) at processTicksAndRejections (:12:39)...

Prisma/tRPC query failing 1/2 the time, but only in Prod

So I have an app, in my local dev environment, everything is working as expected in regards to the DB, I do a fetch to my dev DB and I get the data back as expected every time. I just deployed to Vercel, connected to the prod DB(hosted by Supabase), and 1/3 of the time the fetches work fine, 2/3 of the time I'm getting an error from Prisma that the fetch(s) couldn't be completed, "error occurred during query execution". Trying to think about how to approach diagnosing this since I can't reproduc...
No description

Tailwind CSS dynamically add classes

Are there docs or some guidelines on how the tailwind unused css class purging works exactly and how to avoid the pittfals that might result? Especially in regards to dynamically added or constructed class names.

No typesaftey for dynamic returns

``` // BE publicProcedure.input(z.object({shouldPopulateRelation: z.boolean()})).query(({ input, ctx }) => { return ctx.db.thing.findMany({ include: input.shouldPopulateRealtion }) })...

How do you cache tRPC server responses w/Next App Router?

What is the correct way to define the cache for tRPC endpoints with [email protected] & Next App Router? Cache-Control headers are overwritten by NextJs (https://nextjs.org/docs/app/api-reference/next-config-js/headers#cache-control) Meaning the tRPC docs are not relevant (https://trpc.io/docs/server/caching) ...

I want to get information from the indexedDB and include this in the first render, without delay

The issue is that react code needs to be hydrated before being executed, so you can't get info from localStorage or indexedDB before hydration. The only thing I found that might help is this, https://www.joshwcomeau.com/react/dark-mode/ but it's only for setting CSS variables. chatGPT says there's no way to do this (scroll to bottom): https://chat.openai.com/share/dd719413-5c39-42f1-a695-456971288648 ...

getting error while fetching from uploadthing

i am creating a next.js project where user can upload pdf file which we save using upload thing and later analyse it using open ai api. pdf file is getting uploaded correctly but getting an error while fetching the file: i have tried a lot, it will be really great if anyone can help...
No description

Next Auth google says redirect URI is broken but works on another project

Hi! I am working on a project and I keep getting the error: Access blocked: This app’s request is invalid ...