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

T3 Turbo Build Issue

hey guys im getting this strange error when trying to build t3 turboafter i upgraded from expo 47 to 48 https://cdn.discordapp.com/attachments/943205994123657246/1116227528688939018/image.png Has anyone else had something similar before?...

router.refresh is not working in first load

can anyone tell me why if(!firstTime) is not working ? when i put it inside setTimout for 10s it start working but when i am throttling the network it again stops working? Does anyone have reliable solution for this? ```js "use client";...

How to handle token expiration in RSC calls ?

Previously what I would do is like have axios interceptors and attach tokens in the headers and if call fails due to token expiration then catch it in interceptor. Generate a new token, store it and refetch the original request. But how would this work in RSC. e.g While fetching data in RSC I get tokens from cookies in the server component and while fetching data it expires. I can generate a new one. I can get the data using this new token But I have to tell the client to store a new token so that it can send it the next time. I am not sure how to properly implement this. I have a seperate backend in express...

Running before unmount on server components??

is there a way to wrap a react server component in a function that passes props to it and call something after component is dismounted or something? I know in client components I can make use of useEffect to call stuff before component is dismounted, but not sure how to do the same for server components. what we basically want to do is: 1. create instance of a thing 2. make it available to the component (could be a hook or props , doesn't matter) 3. make sure that the thing executes a function before the component unmounts...

how should i think about trpc with NextJs 13 server actions?

I've been using server actions and it feels like writing trpc functions. Except, there is no react query in the clientside. I suppose I can tie them together and it'll be even more like trpc? ...

proper edge-to-edge setup (i.e. CF workers, regions, and edge auth (with supabase))

What's the proper architecture/setup for an edge function calling another edge function? -------- i'm currently playing around with CF workers and they've been really nice so far. ...

server side localstorage?

Any way to access local storage or cookies server side? I have some light/dark theming in my app, but when loading, there's a blink of the light theme even when it says dark in localStorage for example. Is there any way to avoid this?

Why does NPM try to log in?

NPM keeps trying to log in when I run my pipeline, but I do not know why. My project is located in a private repository from a GitHub organization (I'm the CEO and the janitor at the same time). This is my package.json: ``` {...

Next Auth Refresh Session Token is not working

(please help i spend almost one day on this) i am trying to refetch my session by useSession update function but it's only working in some cases example 1 (where it is not working) ```js "use client";...

PII Data

Hey everyone! Just seeing if you guys are encrypting PII data before storing it, and for those who do, what is your approach to this? I'm the only dev in my company and am just hoping to get a sense of where the industry is with this kind of thing.

Vercel deployment issue with uploadthing

Tried deploying a repo that I just added uploadthing to, to vercel, and got the following error. Would appreacite any help with fixing the issue! Let me know if their's any info that'll help narrow down the problem!

How to get Next-Auth session to include custom properties

I'm working on an app which uses the Next-Auth credentials provider - I'm running into a few related problems when it comes to adding some of my data into the session object and token. I want to add in the username, role, id and profile image of a user to the session and token, and after adding an interface for session, JWT and user in my types definition I have managed to get the token including such fields, but session only has the original default properties in the session object - perhaps related to this, when I useSession and log it on a client-side component I see all my session object as it should be, but reloading the page then gets rid of it (I'm guessing due to the session issue). Below is my callbacks and types definition for next-auth - I've look around a lot triyng to figure this out and keep running into more problems, so any help figuring this out would be greatly appreciated!...

How do y'all deal with writing scripts that interact with your t3 apps?

I want to run some scripts locally in my app, that can read my secrets from env.mjs, use my helpers, etc. I'm running into problems with path aliases, reading from mjs, etc. Has anyone setup a good system for this or have any librarys they know that make this easier? I want to be able to run ts-node file.ts or something similar...

How would i benefit from running docker in development

Hi I'm new to web dev and I'm experiencing some stuff with docker and i would like to get an answer for my question : i have three envs dev in this env should i create a container that runs for example yarn run dev? ...

blocked vercel account

how can i unblock my vercel account apprently i overused image optimization

Configure domains for different environments without autodeploying to Vercel

Hello! I havent connected my github repo to vercel, instead I do "custom" deploys via github actions to Vercel. My problem is that I have two domains in vercel...

how Programming languages are creates ?

Hi. Guys I have a question please , so i study computer science at university , we have built a simple language called NewJava , its syntax is similar to Java, we built the interpreter with c++ , we have done everything lexical thing , grammar , we create token , parse it to create The abstract syntax tree , then for example when we see variable declaration in NewJava such as : ‘’ dec number = 10’’ we store the variable with its value in a hashMap using c++ to keep track with the value, and same...

Has anyone had any luck migrating prisma -> drizzle?

Migrating from Prisma to Drizzle is a massive project. There are no migration guides. Is there a great way to migrate query-by-query? Has anybody done this and had any luck? Piecemeal migrations seem like the only practical way to do this

How to type return of hook based on string passed as argument?

I wanna have different types based on string passed as the argument of a custom hook, but i don't know how to infer types of zod schema dynamically based on a received string. I reckon typescript helpers function might help but i don't know any. ```tsx const validations = { "GET_FRUITS": {...

How to connect Next13 and Sitecore CMS?

My team and I are going to start new project using Sitecore CMS and seems like there is no enough examples of how to connect with Next13. I've seen things with Next 12. Do you have any suggestions? have you tried? Anything to consider?