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

NextAuth OAUTH_CALLBACK_ERROR - checks.state argument is missing

Getting this stacktrace after logging in via google provider on nextauth, as soon as I get redirected. Weirdly enough I am logged in though but when trying to access token it's null, and if I refresh page i'm logged out again. What is this and how can I debug this?

tRPC prisma query type checking.

I'm wondering what the best practice is for type checking a prisma query in a tRPC function. I've been using input validation with zod for passing parameters into the functions but am not sure how to check types for a query which i then want to perform logic onto. `bookingsPerDate: protectedProcedure.query(async ({ ctx }) => { const bookings = await ctx.prisma.bookings.findMany({}); ...

how to get id from headlessui combobox?

i want to take the comic id so i can refer it to tRPC mutation but im still cant figure out the headlessui flow

How to fix session info re-rendering on page reload

Hey all, I use t3 for this app and I wonder if there is a way to fix the text re-rendering whenever i refresh the page, especially for the login/logout side - this uses trpc, next-auth and next 13

post system design question

I am aiming to build a scalable infrastructure (for fun) for a user posting system where timelines exist, such as a feed system. Feeds would include posts of a users followings. Anyways, the current approach is this. 1. UserA follows UserB...

Prevent DesktopHeader from loading on network tab

Hi there, I'm using next/dynamic to dynamically import the header for mobile or desktop. But I have an issue: If I take a look at the network tab (picture below), I can see that it loads both of them even if I'm doing conditional rendering. How would you make it so that the DesktopHeader never appears on the chrome network tab when you're on mobile? As a sidenote if I use the desktop view only the DesktopHeader appears in the network tab (as it should). Seems like the issue is on mobile only as...

How to make a curve in CSS

Is there any way I could make a curve like this. In the reference site they just used a png but that uses more bandwidth

trying to access req and res in trpc query

I need to access res to set a header. I tried accessing req and res from ctx but only session and prisma are available. Any ideas? I tried looking it up but didn't really get anywhere ```ts export const filesRouter = router({...

Why does typescript change the type of user whenever I add this to my return function?

Hi guys, I am trying to understand this about typescript/trpc. Why does the type here keep changing? Why is it not accepting me to type user.data.... ?

I was trying to setup TRPC in NextJS, but I am getting this error somehow, no idea why it is?

I installed the latest packages and was trying the recommended stuff on the TRPC site but this error showed up somehow.

why is there a diff in last line of package.json?

I've noticed that I fairly often get the last line of package.json included in diffs even though it hasn't changed. Anyone know why / how it can be prevented?

Prisma - differences between id, unique, and index

Hey 👋, Could someone explain the difference between @id, @unique, and @index?...

image validation using zod

i wrote this in the tRPC router but it gave this error ``` createComic: protectedProcedure .input( z.object({...

Help with some type declaration

I'm using create-t3-turbo and in expo/src/screens/home.tsx, PostCard component's prop type declaration is as follows: post: inferProcedureOutput<AppRouter["post"]["all"]>[number]; What I don't understand is what the [number] at the end means....

Does any one know how to await trpc queries?

I want to fetch data in getServerSideProps using trpc. Can you await results?

Strategy to test components in React

Hey, I am new into testing and I haven't test anything much before. I am still getting stuck about theory what should I test and what shouldn't. For example here. I have component Heading that takes prop level which is number between 1 and 6. Is this test useless? And if so, what test would you write for this specific component?...

Prisma suddenly stopped working in docker deployments

My docker deployments of T3 apps just broke. They all use the up-to-date Dockerfile from the T3 docks. Strangely, it seems to me like even those that i haven't rebuilt in a long time broke. So the problem might be somewhere in my system maybe? (my host is Ubuntu 22.04). Here's the error i get when any prisma call happens in my app: ``` Unable to load Node-API Library from /app/node_modules/.prisma/client/libquery_engine-linux-musl.so.node, Library may be corrupt...

Has anyone found an easy way to implement HeadlessUI and RHF?

All I find are examples with tons of boilerplate and it feels like it shouldn't be as hard to create a form with a custom component made using HeadlessUI or any other headless ui lib.

Prisma Disconnect Where

Hello, Does someone know how I can disconnect a relation between 2 models based on the id's in an array? I.e....