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

Where to check if user is owner

Hello, I have and app with three entities User, Deck and Card, and now for any operation on card/deck I need to check if user is owner of that deck I'm doing it like this: ...

Does anyone know of a way to programmatically lift classNames into typescript intellisense?

For example, if I import this component somewhere else, I'd like to be able to see the classNames that were applied to the div when I hover over <Example /> ``` export const Example = () => { return <div className="h-fit w-fit bg-red-500">Example</div>;...

How to make emit when some variable changes?

I have a websockets server, in which i want to fire emit when there are n amount of users only ONCE. But for some reason it fires 2 times instead of 1. How would i get desired behavior?

regex

\"/cdn-cgi/l/email-protection#1a726d2d2385a7f777570737e7b753475687d25696f78707f796e27577b68717f6e73747d3f282a567f7b7e3f282a7b6e3f282a5e756f78767f3f282a4a68756e757975763f282a75743f282a5968636a6e75796f68687f7479633f282a50757869\"
\"/cdn-cgi/l/email-protection#1a726d2d2385a7f777570737e7b753475687d25696f78707f796e27577b68717f6e73747d3f282a567f7b7e3f282a7b6e3f282a5e756f78767f3f282a4a68756e757975763f282a75743f282a5968636a6e75796f68687f7479633f282a50757869\"

Types have no overlap, but i have defined the type so that it does in fact have overlap

This is the error that i am getting `This comparison appears to be unintentional because the types '"KVA"' and '"XYZ"' have no overlap.ts(2367)`` Why is this not working 🙂 ?...

Recommendations for auth setup

I've been rolling Auth0 with the nextjs library for Auth0. Now I need to do a full re-write of the site and I'm considering other auth options. Allot of auth0's features cost money, the admin UI is terrible and the login screen we get form auth0 could be more sexy Whatever happens I'm shifting to NextAuth, but what providers do you guys prefer? I want email+password login, about 10-20 users a month. O365/Google login would also be nice, but is not necessary. I don't mind self hosting, the most important part is a good DX and ability to store data about users (like what they should have access too) ...

E2E Tests t3-turbo stack

Hi guys I found out that in the community of the t3 stack, it’s common to use in the examples dirs the playwright for the e2e, but my question is... If I have a turbo repo with expo and nextjs with similar code... should I choose to test with cypress on both apps due to the lacking of playwright testing on iOS? or it’s enough to test it on the nextjs?...

How to set up a development and production database with Prisma

I'm trying to set up two databases with prisma but there isn't much info available. I am trying to use a local postgres db for my dev db and supabase for my prod db. ``` datasource db { provider = "postgresql"...

tRPC response time sometimes takes very long

I'm noticing on my deployed next app that my trpc requests in the chrome browser takes up to 2 seconds, but i've hit the endpoint manually with curl and thunderclient and the request never takes more than 300ms. Has anyone seen something similar to this?

"Unsafe call of an `any` typed value." but everything is typed

I'm using this exact same pattern in 10 other places in my app, but for some reason it is really mad here, even though everything is typed. create even shows on the auto completion. I must be missing something silly

Debugging TRPC issues?

Am I the only one having trouble debugging trpc code? I am talking specifically about endpoints. I can't seem to mouse over variables / objects and it's quite difficult to debug. I am running the debugger with these options: ```json { "name": "Next.js: debug full stack",...

Invalidate query not working

I'd like to invalidate my query but it doesn't seem to be working so I'm thinking I'll pass refetch as a prop and just retrigger the query. This is what my query looks like in one component: ```...

getServerSideProps() fetches NextAuth session put fails to pass props to Next.js page components

I'm building a note-taking app with ct3a, currently working on implementing basic auth features in the UI. Here's my GitHub repo - the relevant code can be found in the auth branch: https://github.com/ChromeUniverse/luccanotes/tree/auth I'm trying to call getServerSideProps() in /pages/notes/index.tsx to fetch my NextAuth session with ct3a's getServerAuthSession() wrapper and pass it as a prop to the main NotesPage() page component. Next.js appears to be fetching the auth session properly - I confirm this through the serialized __NEXT_DATA__ in the browser - but for reason the session won't get passed down into the main page component. Server-side console logs also confirm this: ...

react query not updating the `error` field on errors

I'm new to using react query and i'm using axios to fetch an REST API, the api is throwing a 4xx error but the error field of useQuery() is not updating, the same happens to isError isLoading stays true, so the application gets stuck on loading state forever. I've tried setting retry option to false or 0 but still doesn't work...

what's happening to tailwind's lsp client?

yesterday I left my code working, but today I don't know what is happening with tailwind, I tried updating npm packages and everything. this is the piece of code where I struggled to get tailwind to work: (simplified version) ```js //......

infinite streaming response with tRPC?

I want to create a tRPC endpoint which calls to the docker log API (https://docs.docker.com/engine/api/v1.41/#tag/Container/operation/ContainerLogs). This API can return an infinite stream of data (when setting follow=true) to send data in real time when there's a new log. I am not sure how to send back this streaming data to the client side so that the app can display the logs in real time. I am aware of the existence of tRPC subscription (https://trpc.io/docs/subscriptions) and it seems like that will be what i need, but I don't know how to connect the pieces together for my case. Thank you so much in advance....

tRPC + useSWR for fetching data from Shopify API ?

I'm currently in the process of building a custom Shopify Store running with the T3 stack. I'm using primarily tRPC in order to build most of my API's for fetching data from Shopify's API I believe that the use of useSWR and tRPC together could potentially boost the performance of the app, however, I have no idea whether this is true? Been looking for any kind of documentation on both sides, stackoverflow questions or anything on the topic but was unable to find anything except a npm package trpc-swr (but I avoid using packages that are not that well known)...

Type error when using react-hook-form submit handler

So I'm using react-hook-form with a fresh T3 app, but I'm getting the following error. Has anyone else encountered this?...

oAuth callback uri

Hi, so following a video I tried creating an app and deploying it to vercel with github login but I think I'm messing something with the env vars.. Adding pictures of my github OAuth settings and vercel env vars. What happens is that when I try to login, it redirects me to localhost:3000 with this error: "github?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application." I wanna say that while my localhost is running everything is okay so maybe I missed something that I should have changed....

Vercel Deployment Invalid Env Variables

Hello, I've been trying to figure out why deploying to vercel is causing this issue during the build phase. Everything runs fine locally and I am not getting any errors building locally either. I have a .env with all my keys. I have deployed this project successfully before but after adding my AWS s3 bucket key, secret, region and bucket name, it fails at that part of the build. My env vars are in vercel as well and i have checked using the vercel cli. Any help would be great. It's driving me insane lol....