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 and WebSockets

``` Error [ERR_REQUIRE_ESM]: require() of ES Module /home/xxxxx/Projects/xxxxxxx/xxxxxxx/src/env/server.mjs not supported. Instead change the require of /home/xxxxx/Projects/xxxxxxx/xxxxxxx/src/env/server.mjs to a dynamic import() which is available in all CommonJS modules. at Object.<anonymous> (/home/xxxxx/Projects/xxxxxxx/xxxxxxx/src/server/db/client.ts:6:22)...

railway app websockets?

Any clue if railway supports a server using websockets?

What's the best way to do real time with T3?

I was thinking just using webhooks with the frontend but I'm not sure.

Zob nested object with react hook form?

I have a schema like this in zod: ```ts import { z } from "zod"; const createClientSchema = z.object({...

What are your preferred methods to offer account deletion?

Building on this GH discussion on nextauth: https://github.com/nextauthjs/next-auth/discussions/3935 Do you currently add your own with CSRF etc.? Would be curious to know if anyone here has some strong opinions on that....

Reusable Datatable (Typesafe)

Hey! I'm trying to make a reusable Datatable component, I envisioned basically sending the getter function (tRPC endpoint) as a prop into this component, but the types for this are a bit crazy... Has anyone ever done anything like this before? If so, any tips? Or any other ideas how to approach this problem? Thank you so much!...

Zod validation on client side and server router?

Hi, I am currently using zod to validate my react-hook-form on the client side, I see that the t3 creation has also zod on the backend server route, should I validate using the same zod schema? I thought of extracting the schema to import it on the client and on the backend to not have duplicate schemas. Not sure if there is a difference.

Getting into tRPC !

Have been in the front-end land [NextJs, React, Tailwind] for a while now and I want to give a look at tRPC. I know I can read the docs but my learning curve is best once I start with video, articles then Docs. If you can share the link, would appreciate a ton

Attempting to switch from React-Beautiful-DnD to dnd-kit

Having difficulty figuring out how to implement the Drag Overlay layer.... - I'm trying to figure out the presentational pattern the docs outline. - Can anyone point me to other docs that has more of a tutorial based approach ?...

Making Pusher typesafe with tRPC?

I thought I saw Theo make a video where he used tRPC with Pusher, but I can't find it. Is there currently a simple way to connect tRPC with the frontend and backend versions of Pusher?

Omit key recursively?

I have a type that references itself.
type TParseObject<T>={
[key in keyof T]?: string | TParseObject<T>
};
type TParseObject<T>={
[key in keyof T]?: string | TParseObject<T>
};
...

Is it possible to infer a const type from a Set?

Say I have const foo = new Set([1,2,3]) how can I infer the type of foo as const? For example, const bar = [...foo.keys()] as const is of type number[] instead of type 1 | 2 | 3....

Where to start for frontend

So im trying to decide where to start for the frontend side of development. I decided i wanted to do Actix Web a rust language library for the backend. The reason i wanted to at least do the backend as rust is cause i heard its faster and i want to learn more and use rust. Although i cannot decide what to do for the frontend. Should i use react or what should i use? Haven't ever really messed with react or Javascript this is my first web project

Next app deployment issue on vercel

In my next app, there is an api endpoint "posts" that return posts from the database. I used prisma and planetscale. When I deployed to vercel, api routes with no database querying are working but the one's with prisma code in it are not working (500 Internal Error). Note that I added env variables on vercel. So, I copied production branch env variable to local pc and ran "next build" and then "next start". The production build is working completely fine. It is not only working on vercel. Can an...

learning t3 stack, specifically fetching data from API

Hey guys, so I'm doing a little project, and I want to fetch data from free api website. I know that one of the part of T3 is TRPC, but it seems pretty confusing. What should I learn about to be able to fetch data I want? Or should I just use react query withotu TRPC? is this possible?

Next.js - ReactQuery data is being refetched everytime route changes.

Hello. I made this simple demo, where react query forces refetch every time route changes, I want to disable this behavior. Is it possible? It does refetch only when previous response has been unsuccessful. In my specific example where I am getting user from API, I don't really want this kind of behavior, because it shows loading animation on every page change. My default query client options:...

Is there a way to add only a specific addon to an already existing ct3a app?

Imagine I didn't select next-auth at the start and would like to add it later -- any command for that? Is this codemod the recommended way? https://github.com/kroucher/ct3a-codemod...

rcTable Rerenders useEffect

hi guys, in these couple of days i tried to solve this problem of rerenders in my code, i don't understand the reason for it..., i tried to check if there was like a return statement after the hook or a rule that breaks the hook rules in every component logged in the error but nothing...

Case sensitive search in MySQL with Prisma

Hey guys, how can you implement case-sensitive search in MySQL adapter for Prisma? I see that they disabked mode property where you could set sensitivity in something like Postgres. Is there any way you can do case-sensitive search? Thanks!...