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

What react date picker are you using?

Currently in a need of react date picker, that allows min/max selectable dates, allows month view, date selection, date range selection and most importantly can be easily styled using tailwind. Any suggestions? 😄

shadcn ui dark mode

Hi guys! Are you using nextjs with tailwind and shadcn? How do you implement dark mode?

Any ideas why TRPC doesnt find the mutation?

I have am trying to use a create many Prisma call in a TRPC mutation as follows: ``` import { z } from "zod"; ...

InfiniteQuery or Pagination

how to implement it with the Drizzle orm, is there some example, how to use cursor?...

I'm having trouble using the shadcn-ui Sheet component

I keep gettting the error below Error: DialogTrigger must be used within Dialog anybody know what I might be getting wrong...

cookie session - express-session with tRPC

Does anybody use express-session with tRPC? What is the best solution to use cookie sessions with tRPC? (using redis as a storage)...

Unknown arg `emailVerified` in data.emailVerified for type UserCreateInput.

`` pprisma:query SELECT main.User.id, main.User.name, main.User.email, main.User.image FROM main.User WHERE (main.User.email = ? AND 1=1) LIMIT ? OFFSET ? [next-auth][error][adapter_error_createUser] https://next-auth.js.org/errors#adapter_error_createuser Invalid prisma.user.create()` invocation:...

Function overloads with more than 1 parameter

Im trying to overload a function that the first two parameters are string and are not optional, the first parameter should be an union type of strings and the second parameter should also be a union type of strings but these should depende on the first parameter. For example, we have the next function ```ts function callOutsideFunction(module: string, method: string): unknown...

Acceptable Layout Shift

Is this acceptable layout shift for a skeleton loader? Not sure how to handle the possibility of the course name going to two lines or not.

How does a React component require data to render in a SPA

I watching Theo's video on SSR https://youtu.be/kUs-fH1k-aM?t=358 and around 5:58 he mentions that in a SPA a user doesn't see anything until the data is loaded, unless you've got loading spinners telling the user data is incoming. Having only every used fetch inside useEffect or React Query in SPAs, I've always fetched data once components have rendered. Can anyone show me an example of a component in a SPA that doesn't render until data is fetched?...

Why do my static files not load on first load and my links not work on first click?

The logo of my navbar is a static file under the public folder. It works just fine on localhost but on vercel the alt is displayed on first load. After refreshing the logo is visible. Also the links in my dropdown menu don't work on first click when deployed. Maybe these problems are related? Sorry for asking such a basic question but any advice would help me out a lot! 🙂...

Should a react layout component be responsible for initial required data fetching.

So I am building a dashboard for a course page. There are different routes that the course page can have. For example /courses/9 /courses/9/settings /courses/9/members...

how to properly handle passing trpc results as parameters?

I have the post data fetched like this: const {data} = api.posts.getAll.useQuery(); then I passed it to a component
//@ts-ignore <FeedThread posts={data} />} I ignored the undefined error because I'd like to handle the display in the component....

Help with s3

I got the bucket: ``` show se-1 ep-1...

how to use indexeddb with react query (dexie.js)

im working on a project that doesnt have a hosted database, everything is done locally. im using dexie.js as my indexeddb wrapper, and im wondering if/how i can use react query with indexeddb instead....

flexible tRPC - is it as flexible as GraphQL?

airbnb and graphql had the problem to have scalable APIs that can grow, are flexible and are backward compatible graphQL solves this problem, so lets say we have something like this: ```gql persons { id...

why do we add prisma in ctx instead of using import ?

As stated in the doc
We include the Prisma Client in Context by default and recommend using this instead of importing it separately in each file.
We include the Prisma Client in Context by default and recommend using this instead of importing it separately in each file.
but there is no explanation Why is it better ? What is the difference ?...

How can I hit my trpc endpoint in a event handler?

I am trying to hit one of my trpc end points on form submit but i keep breaking rules of hooks

What does acme stand for?

I have been playing around with turborepo for a bit now and I noticed that there is a convention to name packages in repositories such as create-t3-turbo w/ a prefix of @acme/. I tried to search through Turborepo's docs and Google, but I didn't find anything useful, but what does acme stand for?
Solution:
someone opted for @acme/ for turbo

Using tRPC to connect to two different apis

I have a create-t3-app where I am using tRPC for the api. It works great but I need to run a separate server for some long-running tasks (which won't fit on vercel) and I want to use trpc for that too. I created a separate createTRPCNext for it, and in _app.tsx I have:
return secondApi.withTRPC(api.withTRPC(MyApp));
return secondApi.withTRPC(api.withTRPC(MyApp));
The problem is that tRPC only looks at the inner context no matter which api I use in my code, and requests are sent to it. Is there a way to have the 2 contexts not get confused by tRPC?...