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

Frontend reading first 2 lines in large csv file

Is there a clean way to read only first 2 lines in csv file without loading whole file into memory? Users can upload big files and I want to read header column of those files

Does a react Context component with a provider only get mounted when the provider is mounted?

ie does the code inside of say FooProvider ```jsx // ./FooContext.tsx const FooContext = useContext() export const FooProvider = () => {...

rules of hooks question

Im looking at an article rn (https://kentcdodds.com/blog/how-to-use-react-context-effectively) and trying to do something similar in my context with using a custom hook that calls the useContext(). However im getting invalid hook call error, im assuming for abusing the rules of hooks.

change query params without rerender

When you useMutation with trpc, you call the endpoint with some input when you call .mutate, which is easy enough to do when you click a button or something. Is it possible to do the same with a query? useQuery takes the input and I don't see a way to change that without rerendering and calling useQuery again - eg type something in a text box and use it for a query without rerendering. I know queries and mutations are pretty much the same under the hood so the solution is to just use a mutation...

Adding Headers Breaks COR's with Next.js

Having a weird issue. I want to post to my API route cross-origin, so I added this to my next.config.js: https://vercel.com/guides/how-to-enable-cors When I make my post request from the browser like this I get a CORs error:...

How do I use less bandwith?

I'm working on a project that requires a short looping video in the hero of a project. Does anyone have any suggestions on how I could lower the usage on vercel by maybe uploading it somewhere cheaper or storing it somewhere else?

Is it safe to implement Git Repos with few users, even when they're well maintained (jotai stuff)?

I'm a Dev at a company that actually respects my input on things, and I saw a wonderful opportunity to implement Jotai. It was the perfect use case for it, and when I implemented it, every other Dev loved it (we were doing "state prop drilling" trough components, so to speak, and it was really annoying). However, my Dev Lead (whom I respect immensely) got worried about Jotai, since he never heard of it. We had a brief discussion about the git repository and his insecurities. He pointed out that the amount of users of Jotai is very small when compared to the amount of users that use Redux, for example (source: https://npmtrends.com/jotai-vs-react-redux-vs-recoil-vs-zustand)....

DB seeding

Will there be any plans to add a db seeding template to the T3 stack? Perhaps a script file that users can edit and run a db seed script to populate the database? Thanks!

Typesafe access of 'unknown' type

I'm trying to access the error variables returned by a try-catch

GCP SQL via prisma

I got a more or less empty t3-app for test I have tested on 2 databases. postgres on Railway, works perfectly fine postgres on GCP SQL on the second one prisma works fine, I can even do prisma studio and I have no problem accessing data...

Creating your own reusable components cross project (Bit.dev Storybook)

I’m rebuilding my site with the T3 stack and I’m going to be having an extremely similar site to it that I also host for premium users. These sites will share a bunch of components so I want to find a way to write my components once and reuse them. For tooling on this, the two options I’ve found are: https://bit.dev/...

NestJS with Auth0

Hi all, so I'm interviewing with a company for a full-stack JS position. They sent me a challenge and there's a part of it challenging to me, they have an Auth0 app ready to be used by candidates, they just sent me jwks.json file. I don't know exactly what to do with it from the backend side (NestJS), because usually when I integrate with Auth0 I create my own app and just follow the docs to complete the integration. Any thoughts?...

Partial rewrites using nginx

Anyone here familiar with doing partial rewrites using nginx? I have a setup with three containers: - nginx - legacy app (lives at www.example.com)...

[Prsima] findUnique() vs findFirst()

Could somebody explain the difference between "findUnique()" and "findFirst()"?

is it possible to find some npm package | binary | script that does this?

css file: ```js action: someCssLib.component[TAB] // the result is the css or the tailwind equivalent of that style component ...

TS-newbie struggles with TS via NextJS Layout

I am creating a simple layout file that looks like this: ```ts type Props = { children: ReactNode; title?: string;...

PRIMARY KEY in supabase DB

Hi everyone! I’m creating a full stack app with tRPC and I’ve connected Prisma to a supabase postgresql DB. Everything works fine but when I try to delete columns I have a error saying that I need a PRIMAY KEY. Can anyone please explain to me why I need that primary key in order to delete /edit my data in DB? 🙏 thanks...

How to pass in a React icon as a prop and style it with Tailwind

Hello I'm trying to create a reusable react component that takes in an icon and I want to style said icon with a base style. I included some screenshots of what I have so far. I've been at this for a while, any help would be very much appreciated.

useQuery param is undefined. but query is enabled only if the param is defined.

im trying to set up some searching. and came across this error. i am not sure if i am missing something in my reasoning for why this should work (some react or maybe react-query rules/quirks). SSR is off btw.

SSR useQuery Breaking Page Transition

Technically using an infinite query, but I have an array of Posts that I'm prefetching, but when I use a next.js Link I get an undefined error during the transition