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

Assigning Default Custom Components to HTML Elements in Astro

I'm using tailwind in Astro with mdx content so I want to setup default tailwind classes for the HTML rendered from markdown. I've switched from file based routing to dynamic routes like this: https://docs.astro.build/en/guides/markdown-content/#example-dynamic-page-routing So I can then set my custom components in one place like this: https://docs.astro.build/en/guides/markdown-content/#custom-components-with-imported-mdx Ideally I would like to be able to pass props into the components when I set them up so I can use a generic Heading component that takes a size prop to render as H1, H2, H3, etc......

When does _count exist in prisma?

What's the difference between post and category that the category has a _count field available? here's the relevant parts in the schema ```prisma...

reduce initial response time

Im building app with T3 stack but initial response time if I enable SSR in trpc is pretty slow. What usually causes it? Im using the whole stack. What are the ways to improve it? https://cryptosito.vercel.app/ This is live website...

How do i find my previous question if i don't remember how it is worded.

Random, but someone posted a useful link to a question i asked. I can't find it tho 😦

How to check if type is array?

I have the following interface ```ts interface IFilterOptions { price: { min: number,...

How to make a trpc request wait on another hook

I basically have a state that is populated from a query param then an API call (i used context before and now jotai) but it is critical to populate that state first before issuing a following trpc call that will fetch something. ``` // store.ts export const currentGuildAtom = atom<DiscordGuildProfile | null>(null);...

UI Primitives for svlete

I'm bootstrapping a new svelte project and I was curious if there was a library that is similar to radix primitives? I want to still own my design system, but I don't want to design so many components.

Typescript doesn't show which prop should be provided

My component looks like this: ``` const ToggleGroup = React.forwardRef< HTMLDivElement, React.ComponentPropsWithRef<typeof RadixToggleGroup.Root> & {...

Pagination for multiple items

Let's say I have 100 000 rows of data in my database and I have a REST API to query these. Obviously I can't query the 100 000 rows at once so ideally I want to have around 25 rows in my UI present and 25 on the next page and so on. Question is, how to do this in an efficient way? How to request the right amount from the server and so on Thanks...

nextauth deployed in gcp no_secret

Hi im currently deploying my app into gcp and somehow it keep saying NO_SECRET in the logs i tried setting up variables in .env with 1. NEXTAUTH_SECRET (and nextauth will automatically get the secret) 2. set custom variables like MY_SECRET then define it in [...nextauth].ts secret: process.env.MY_SECRET...

Can anyone share how to infer type of class member of trpcresponse

I am using inferRouterOutputs<AppRouter>['abc']['def'] to get the type of response, now I need to get the type of a member of output response , please share if anyone has done this before.

How do I make the grid or flex item grow to the size of the parent on click?

i have tried to make the other flex items hidden on click but I can't figure out how to animate it.

env Variables causing issue deploying to Vercel

Howdy! So I'm trying to host my CT3A on vercel. The build is failing, looks like it's the env variables that are causing the issue but I'm not sure what I'm doing wrong. I double checked that my schema.mjs file isn't missing any variables, and I actually did miss one, so I figured sure that must be it, but even after adding it to the repo, the build is failing for the same reason. This is my schema.mjs...

styling feedback pls

thoughts on the tilt for active page? just wanting advice, thanks

Hi, I am getting a hydration error and I am hella confused on why. I dont see any incorrect tsx here

I am trying to make a table but for some reason im getting a hydration error on this one page

How Can I Pass a Ref Down To A Child Component and Have It Not Just Be The Starting Value

Hello, I have a bit of a odd question and 99% of the answers for this I have seen are for class components and do not translate to functional components. I am essentially trying to do the following: ```ts...

Next Auth Production Issue

I have a web app using session auth of NextAuth for authentication. It works fine locally, however, when deployed to Vercel, it errors out when logging in via Email Provider or Credentials. I am getting this weird error: ...

add fields to session

I'm using Prisma and doing an initial query to get orgId from my User table before almost every query/mutation. Ideally I'd just like orgId to be included in my ctx/session so I can access it directly similar to ctx.session.user.id. I have orgId in my Session table already, but not sure how to map that to context/session. an example of a typical query: ` getLowInvWarnings: protectedProcedure.query(async ({ ctx }) => {...

Array with generic vs type[]

Using array with generic works but the same thing using type[] does not. anyone know why? thanks

Deploying to AWS Amplify

Hi, my company is wanting to deploy an internal T3 app, but hosted on AWS Amplify. I've seen various tuts on deploying Next.js apps on Amplify, but it seems that tRPC is not playing well with it. Does anyone have experience deploying to AWS Amplify, or otherwise have any suggestions? To preface, I've been told we cannot deploy to Vercel.