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

TRPC Prisma using connect properly

Hi guys just created a new app with createt3, I think some things changed since the last time I used prisma and trpc, so I have following basic schema setup: ```ts model Movie { id String @id @default(cuid())...

nextAuth causes error - Module not found Can't resolve 'nextheaders'

I'm suddenly having an error on all my pages that says: ./node_modules/next-auth/next/index.js:97:6 Module not found: Can't resolve 'next/headers' Stack:...

How to deal with constantly updating data

So i have an app that fetches some data from some endpoint. Some of this data will change every 2 weeks, not all of it. One way to get the updated date would be to restart the app. Would i need to setup a cron job? setInterval? Im wondering what would be a good way to go about this. If it helps, this is relating to the game league of legends, which has patches every 2 weeks. ...

Using existing color names in tailwind config

seems like a good idea to do it this declaritive way instead of copying the underlying colors into the tailwind css... is something like this possible? how do describe it to google? what is the correct syntax? Thank you!! ```json extend: { colors: {...

Animating a Hero title

Playing with animations with vue/headlessui. Trying to create a Hero title that has a highlighted word that rotates and animates. So it would go from "I am a bilingual person" to "I am a bad person" (ignore the words, just for the sake of the demo :P) and keep rotating....

How best to implement browser feature detection?

I have a set of features, some css and some web api that have spotty support on safari, edge, and ie. Is there a standard way of targeting per browser environments or wrap unsupported features in a conditional? All i've seen is hacky css media queries hooking into a particular unsupported css feature to estimate the browser version... Is there something more foolproof or standard? ...

TRPC List Of Editable fields linked to unique database field

Using the full t3 stack, how do I have a list of inputs to display and link one of each document in a prisma query (just an array of objects)

Headless UI not working with NextJs 13 app dir

I copied just simple example from docs of Headless UI of Disclosure and without any errors it just doesn't work .

ngix bad gateway 502 error

so i deployed my nextJS app using nginx with pm2 , i have an end-point where i set headers for update the authentication cookie , in /var/log/nginx/error.log i can see this : [error] 36131#36131: *23 upstream prematurely closed connection while reading response header from upstream, client: 15> , any configuration to set ?...

Which drag and drop lib would you recommend me these days?

Hey! I saw a lot of discussions about D&D libraries, that some of them are depreciated, but still used. So that's why I'm asking which one would you recommend me?

mantime vs chakra

I need a component libary😔

Building a design system?

Hi Guys, I'm taking first steps to build a design system... would love your advice before i go too deep. I'm using tailwind-styled-components: https://github.com/MathiasGilson/tailwind-styled-component ...

Read input from many child components

I have a page with hundreds of text fields. From the page, I'm trying to read the user's input from each field when they click on a button. useState can work but would be too slow What would be a better solution? Should/how do I use useRef in this case?...

Does CRA have any weird issues with rendering images?

I know I shouldnt even be using CRA, im moving off of it, so dont yell at me lol. But is rendering images a known issue that it has??

Are there any examples on how to implement web notifications?

If, for example, a User A leaves a comment on User B's photo, how do I show a notification to User B? I would need to know if User B has seen the comment or not. How would I check that? I'm assuming I would need a Notifications Table in my database with a one-to-many relationship. Where each user would have one notification table with many notifications. The notifications would have to get deleted automatically once the user sees the new comment. Are there any examples that show how to implement such a system?...

Prisma query failing in NextJS deployment

I have a NextJS project which is using prisma and Planetscale. I have a webhook from Stripe where I read from one table and then write to another. The first prisma query always seems to fail. I have added other random queries before it, but it is always the first one which fails. After that failure/timeout (~5mins) the next request always runs instantly. When running locally everything works totally fine, but it always fails when deployed. I am using global.prisma to ensure there is only one PrismaClient in the entire project (as described here) I think this might be connection pool issue because the error message is this (but I'm not sure why this would be the problem):...

Best way to add CRUD to routers without duplicate code

Is there a best practise on how to add CRUD functionality to multiple routers without repeating the code for it?

tailwind newly added spacing overrides the defaults

I just added this custom spacing to tailwind: spacing: {main: '10%'} and other spacings eg.py-4 stopped working....

Should you share zod schema from server side to client side?

I have a zod schema which is used to validate trpc router procedure on server, and I need same schema to validate input on client side form, so, is there any security threat, if I import that server schema on client component?...

import HASH slash styles

import '#/styles/globals.css'; Reading the code in https://github.com/vercel/app-playground and they're using a convention ```typescript import '#/styles/globals.css';...