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

Is there an existing tailwind-react library to use?

I recently bought tailwindui, but I find it quite annoying to manually create a component for every single component, i.e. copy-pasting the html, then adding various props with 'class-variance-authority' etc. Is there a pre-existing tailwind react component library, where we can simply copy the existing .tsx files into our project? I feel like this would save a lot of time, while also having full control over the components themselves....

t3-stack tRPC ssr

Hey, I'm having trouble understanding how ssr works with t3 stack config. If I do trpc request inside component it makes it ssr by default? Do i understand it correctly? I haven't seen anyone using getServerSideProps so i assume it does? Can I read somewhere more details about that?

react-hydration-error using different browser?

I am trying a different browser right now called Sidekick, accessing my localhost returns this error: ```ts Error: Hydration failed because the initial UI does not match what was rendered on the server. ...

How to get type inference from Prisma with Zod

my question is how to type from prisma User model using zod-prisma package. I was trying to post the full question here but because it is too long and I do not have enough characters I will put a link so you can read all the details. https://stackoverflow.com/questions/75680609/type-inference-from-prisma-with-zod...

How to view your data in PlanetScale?

Is there really no table editor view, similar to Prisma Studio, in PlanetScale? I assume there is only access via the web console, which is kind of a bummer. Anyways I can't view my data in the web console. Following the directions here https://planetscale.com/docs/concepts/web-console, I entered SHOW TABLES; into the console. That gave me my list of tables. Then I ran DESCRIBE USERS; into the console, then it gave my an error that that table does not exist, even though it shows up in the result...

Date Filter Search Prisma Query

In the attached picture, I have a prisma query that returns all products in a store. If the date value is 1 or 0, the where clause will return products created yesterday or today. If the date value is greater than 1, the where clause will return products created within the last date value number of days. The second image shows what the createdAt values look like in my database. Using the UTC timezone, this all works perfectly on local machines. However, when I deploy this to Vercel, the date fil...

Anyone know how to use React Query + xstate together?

I'm trying to use React Query (from TRPC) to fetch data that I'll feed into my state machine using xstate, anyone have any good examples on how to do this?

prefetchInfinite causing query on initial load

I am prefetching the data in getStaticProps and it fetches on initial load even with staletime set to infinity. https://www.loom.com/share/454e3d2b75fa426d923e119775d1086c

Question about Planetscale storage utilization

Hey all, I'm just testing around with some data and I use Planetscale to take care of my database. I'm currently adding and then deleting some test data, but the storage utilization graph keeps going up and I am a bit confused why that is. I expected the utilization to fluctuate because I keep deleting more data that I'm adding....

How to use react toastify to show a promise toast when using a mutation in trpc?

I'm trying to show a promise toast but cant figure out how to do it. Can someone please help. Thanks...

When developing locally, is there a purpose for having a Dev DB vs just having a local DB?

I'm reading through the planetscale documentation and they mention the differences between dev DB branches and production DB branches. It makes sense that to test the schema changes proposed in a staging/development branch before promoting to production, but would it ever make sense to connect to a dev DB when developing locally as opposed to just spinning up the db locally?

Good way to handle redirect on unauthorized request response

Hello, I want to redirect to landing page when any of the auth checked endpoints return 401. Currently I've landed on a solution where I throw a specific error when response status is 401, then check the error message on the fetch hook. This solution requires every service to implement that if check, feels kind of clunky. Any suggestions?...

data pipeline for custom user analytics dashboards

I have a project with user generated content and would like to be able to provide personalized analytics dashboards to each user. I am using mixpanel (but open to switch providers) to log analytics events like page views and engagements. I am also using T3/Vercel/Planetscale. I am curious if anyone has experience or guidance building out a feature like this. I can query mixpanel's APIs for the data I need to build these dashboards, but because of the rate limits it does not make sense to do this on-demand in an api route. - Should I schedule a cron to export/parse the data and write the reports I need to my primary database?...

SEO best practices in t3

Hi, I am new to the t3 stack, coming from remix.run (which was a big letdown). I want to create an e-commerce app using SSR technologies with a decent + SEO. As far as I can tell and from the examples I see, the data is fetched on the client using react-query. Can some one refer my to a blogpost or a github project or video, any material out there on the subject? thanks!...

Issue with useMutation() when trying to test React component

Hi, I am having issues with my test failing since it cannot render the component properly because of this error: ``` TypeError: Cannot destructure property 'client' of 'useContext(...)' as it is null. ❯ Object.useMutation$1 [as useMutation] node_modules/@trpc/react-query/dist/createHooksInternal-416876ed.mjs:372:17 ❯ node_modules/@trpc/react-query/dist/createHooksInternal-416876ed.mjs:50:34...

Creating APIs with Bearer Auth in API Gateway

Hey all, I'm just looking for some resources on setting up bearer authorization in AWS. At the moment I have API Key auth implemented, but would prefer a system where they hit /token with their API key and use the returned JWT bearer token for subsequent requests with auto refresh and all of that nice stuff. Most of the resources I've found online have been tough to digest, so I thought I'd see if anyone has experience doing this or knows of a good resource to learn about it. Thank you!

using prisma accelerate in t3

im abit new to ts, so how do i tackle this error, thanks in advance

Using Upstash

Hey guys, I was wondering if i could get some insight into the best way to design the following system. I have a rough idea on how to design it but not 100% sure. So I have IoT devices in the field, and only activate when a certain sensor is enabled (which should send a notification to the user with the data)....

Vercel: Private Past Production Deployments

Hope you liked all of the alliteration in the title. Anyways, I was wondering if there is a way to prevent previous versions of production deployments from being publicly accessible. I'm aware that this is possible for preview deployments, but I wasn't able to find a way to do this for production deployments. I see that there is an option to "Also protect my Production Deployment" (see screenshot), but the wording implies that this is for all production deployments, rather than just previous o...