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

Drag and drop UI

Hey guys I am trying to do some array rearrangements which drag and drop package works best with typescript that I can use with react’s current version...

Data visualisation library

What's the best data visualisation library within the react ecosystem at the moment?

Cheapest hosting service

Hey y'all I need to host a website, it's static for my blog and portfolio. I need the most cost effective hosting service. Any recommendations?

Could I get some help for this Prisma schema?

I'm currently creating a "guess the rank" web-based game where you choose a competitive game, watch a short clip of gameplay and then guess the rank of the player in that clip. It's pretty simple and there's a few websites out there already. Each game can only have a single clip for that day. I reset the clip at midnight via a cron job and that all works fine. But I'm not sure if the way I'm storing the daily clip for each game is good. I originally thought I could have my Game model contain a featuredClip Clip but game also contains clips Clip[] and I can't figure out how to get this relationship to work. I've tried naming them but it didn't work. Still new to this. I'm currently trying to clean up my database and I wanted to know if the way I'm currently doing it is fine or should I go for the seconds approach, or even something different....

devDependencies difference with dependencies in package.json

I have found the following stack overflow question, but I want more context if possible: https://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies I wanna know how and for what reason tailwindcss is in devDependencies and if I want to add additional packages do I always add them to normal dependencies and in which case (not basic, for development) you add there? I see that even typescript is listed as devDep....

Random/inconsistent TRPCClientErrors in local environment.

Did a search in here but couldnt find anything relevant. Im making a small game to learn T3 stack stuff and Im having a problem with this autosave interval in combination with prisma/trpc. On most triple mutations there is at least one error on the receiving mutation but it seems totally random. Sometimes its the first one, most times the second or third one fail but its not consistent at all. Is this just a local env problem? Havent tried in production. Did some googling also but couldnt find a...

ctx.user.session.email possibly null | undefined

``` get: protectedProcedure .input(z.object({ id: z.string() })) .query(async ({ ctx, input }) => { const texts = await ctx.prisma.text.findMany({...

avoid rendering more hooks: running trpc query based on supabase session's user

i have a router workspace with query getWorkspace that takes the current supabase session's user's UUID id and returns details of the workspace they're a member of ```js export const workspaceRouter = createTRPCRouter({ getWorkspace: publicProcedure .input(...

Moving to NextJS

I'm new to Next and went through their tutorial. 3 questions - 1. I want to build a landing page for my company. Should I be using the app directory which is in beta or stick to pages? 2. My web app is currently built with create-react-app but I have been wanting to move over to the T3 stack. However, after going through the Next tutorial I am unsure how it would actually be beneficial given most of the rendering I perform in my current app is client side rendering and it looks like, to me, that it would continue to be with Next as well. Literally all that is possible for pre-rendering is titles (maybe 1 on each page) or inputs and their titles (wherever it is interactive). Maybe I'm missing something in terms of the benefits Next provides. 3. All my fetching and caching is done with react query. It has been an incredible library (especially for optimistic updates). Does the future of Next involve react query being as complementary? Just curious...

<suspense>

Can the React suspense features be used with tRPC ?

How do you all handle Role based access?

I'm creating a new Next app which will require RBA. So let's say I have 2 routes for my user roles: /student/* and /teacher/*...

I am trying to understand the necessity of Kafka

Suppose I have a dashboard where we will show the user about the stock changes over a span of time (e.g. 7 days, 1 month, 1 year, 5 years, etc.). We have a database where the stock gets updated every 2 hours. Can I just read the data from time series db? Is Kafka even necessary in this use case?...

Nextjs | Set cookies header

Hi, I want to make a call to an API (which I don't have access to) that returns headers with cookies, however the cookies are blocked since the host domain is different. I tried to use rewrite in the config file but it did not change anything, does anyone have a solution?

infer parameters of function passed as prop on a react component

is there any way to infer the parameters values of a function passed with props? I am trying to create a like button that raises an event once the user clicks on it, the like component only call the function passes via props and i handle the click on the main component. The problem is that in the like component i should pass the person object but i cant because i dont know about it, its passes as argument of the callback (onLike)...

Does cache control header work out of the box on self hosted NextJS APIs?

Does the
"Cache-Control": "s-maxage=123123123"
"Cache-Control": "s-maxage=123123123"
...

Looking for advice on how to fetch/load an onboarding banner

I'm using T3 inside a monorepo (turbo repo). For new users, I have a Get Started page that has a handful of checklist items. These checklist items are fetched from my database and ensure the user has finished the onboarding process. If there are still steps remaining, there is a banner at the top of the page alerting the user to finish their onboarding steps. My Question: Does anyone have any suggestions on how I can structure this so I'm not constantly running this query? Because right now, even if the user has completed all the steps, the app will still query and check to make sure all the items are complete. This in practice is good even after the user is finished onboarding because I want the banner to reappear if they delete their payment method or something. Can this be 'lazy queried' (not sure if that's a thing) or maybe run in middleware or something to where it would have minimal impact on the performance? Or maybe I'm overthinking this and I should just keep it as is? But in general I'm getting the feeling that I am running unnecessary queries and there is a better way to handle the logic here. ...

Stack for Discord Bot + Webinterface

Hello! I am new to the t3-app stack and was wondering how to properly implement a service like discord.js into t3. The Discord bot instance needs to pass live data to the web interface. Is there any way to accomplish this? How could the project structure look like?...

Stripe webhook error

Next 12: I've followed Next official guide for integrating stripe into my published site on vercel, and was able to make a purchase, but I fail using a webhook after a successful payment. On the Stripe dashboard, I see this error: "Webhook Error: No signatures found matching the expected signature for payload." My code for my api endpoint for that webhook is taken from the guide:...

`onSuccess` is typed correctly as `data: ReturnItem` for one mutation but as `data: any` for another

onSuccess is typed correctly as data: ReturnItem for one mutation but as data: any for another, any ideas why? I see no apparent reason.

Google Provider when deploying

I'm trying to deploy my project on vercel with a custom domain, but I'm getting an error that says something like: Google OAuth 2 authorization - Error: redirect_uri_mismatch. does anyone know how to fix this?...