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

Dripsy Intellisense issues with TS 4.5 and higher.

Someone that has any ideas why Intellisense isn't working for Dripsy with TypeScript versions higher than 4.4? 🤔 It works if I write ```ts bg: ['...

Link to page with tabs

Hi! I've got a page in my ct3a project which has three "tabs" one can open (only one at a time). By default when opening the page, the first tab is open. However I want to redirect a user to the page with a specific tab open. What'd be the best/standard way to do this?...

axiom + t3, how to log

I would like to use the req.log from next-axiom (see attached image) but I cant find req and res using t3. Any ideas on how to implement next-axiom into t3? https://github.com/axiomhq/next-axiom

Next JS Image Warning

I was getting this warning while using next/image
Image with src "<image_src>" was detected as the Largest Contentful Paint (LCP). Please add the "priority" property if this image is above the fold.
Image with src "<image_src>" was detected as the Largest Contentful Paint (LCP). Please add the "priority" property if this image is above the fold.
and when I add the priority prop to the <Image /> component I get this warning.....

Developer recommended payment processor?

I have started a small side project that sells products that are not allowed to be sold by Stripe or Paddle. I am however currently using PayPal but they are very frustrating to use as a dev and as a business. So what payment processor do you recommend?...

Retrieving data without using getServerSideProps and not exposing API keys

In my application I have a custom _app file which restricts using getServerSideProps but I need to retrive data from and external API without exposing keys, what is the best possible way to go about it?

Is useEffect hook good place to manipulate DOM?

Have been developing a multiple state components, was wondering is useEffect hook is good place to add css classes for elements? ``` export const Input: React.FC<InputProps> = (props) => { const { label, name, error, ...restProps } = props; const inputElement = useRef(null);...

Why is railway so expensive?

Railway costs 10$/gb of ram/month and 20$/vcpu/month. This seems a lot higher than just deploying something yourself. Is there any reason other than how easy it is to deploy for which you should use railway?

Save Next-auth Refresh Token

Hey was wondering if there is a way of changing the cookies that are presented by default when logging in and using my own cookies to have a refresh token? Unless im miss understanding what Next-auth does cause don't you need to have some database and a refresh token to check againts the cookies the user provides?

T3 Stacks requires internet?

Does tRCP requires internet connection for been used? I was in the field without internet conection and the requests to the backend tRCP were not been executed

React Function Components vs Class Components

As a web-dev noob is there a big difference in performance, safety, cleanliness, etc? What should I use and why if using create-t3-app? It seems like the negatives from theo's useEffect rant can be mitigated by class components?

How do I get Tailwind Intellisense on activeProp?

Using @tanstack/react-router and styling links using the activeProp. How do i get tailwind intellisense to recognize this?

Does anyone have any examples on how to declare global user context from database with t3 stack?

I know I can get the session from next-auth with useSession() but I need a way to get current user ID from the database. useSession() is not connected to the database.

Insert Role before authenticating in Next Auth

The create-t3-app provides a small explanation about how to modify the User model in Prisma's schema.prisma file. It mentions that we need to add a default role. But while using an auth provider, for example google, I want to know how to let next-auth and Prisma know the role of the user before the user is authenticated and their details are entered into the database? It seems like after the authentication, the user is automatically added to the database and the callback session of next auth is executed only later. I have 2 roles in my app (a seller and a buyer). Both have different pages but use the same signin function to authenticate. How do I tell the signin function to add a particular role instead of the default one?...

React Query refetch is refetching very slowly

So I'm running into an issue with react query where I am having to put an event listener which refetches the data to display. Essentially, we're using a 3rd party api to schedule meetings (Nylas), and their api is interesting, and requires you to attach a modal to the window. We are refetching the data when the window sees the modal closing. We know that the event listener is running due to a console.log. However, when we call the refetch function, the data doesn't update right away, instead, it will stall for a few seconds, and then eventually update. We know that the data is updated, since when you reload the page, the data is correct. Any ideas on what I could be doing wrong here? Should I be running a useMutation despite not owning the 3rd party api? Am I misunderstanding refetch? Thanks in advance!...

Recommendations for generating public api docs

Work wants to use something like swagger to show public REST api docs, any better alternatives? our endpoints arent openapi compliant I think anyways. would like to not force api design if i can get away with it. stuff like astro is cool but looking for something that requires less maintenance and more bring your own content like...

Prisma is not returning a type that has the property for the included relation

Hello, I am using prisma to query some data from my database where the name of the relatonship is data so the final record object looks something like this ```...

TypeScript powered settergetter of objects by path

Does anyone know of typescript powered alternative to lodash get/set methods where I can get or set value by a path to it and it will also autosuggest building path?

Know of any alternatives to tailwindUI?

Hey guys, I am looking for alternatives to tailwindUI, meaning design systems that use tailwind for the CSS and headless for the javascript/behaviors like headlessUI. Any other libraries such as MUI, Bootstrap, or ChakraUI that don't use tailwind out of the box are not an option. This could be good to have a free alternative for the community since tailwindUI is quite expensive and not everyone is willing to pay for it. I know about the libraries Theo talked about in this video: https://youtu.be/CQuTF-bkOgc?t=1057...

nextauth with next13 - invalid body

I've used basic guide and doc to incorporate nextauth and google as provider in my next13 app. I also have prisma with cockroach. When I use the "signIn" func of nextauth, I'm being sent to: "http://localhost:3000/api/auth/error" and it returns an error that says: "invalid body" I wrapped my main layout with the "SessionProvider" of next-auth....