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

Server actions in server components

I have been under the assumption that calling a function marked with use server on the server is just treated as a regular server function. But I then stumbled upon a random vid where the guy mentions that calling a server action from the server means the server will be fetching from what's effectively an API route the same way client components do. Couldn't find explicit evidence for this claim though. ...

does the interviewer (technical interviewer) or dev responsible for hiring review your projects code

I am refactoring an old project it's an ecommerce project i didn't have the option to view the product in a seprate page so i wanted to add that option , I have my products stored in an Array in firebase now that i understand firebase more i learned that i can't use it's querying capabilities to filter my results instead of having to loop over the whole Array to get the item i want it's a total of 226 items i know that if i add more products it will effect performance later there is two cho...

Server side data fetching based on input from a client

So, I want to fetch data on the server with server components based on the input from the client component in this case workspaceSlug. What is the best approach to go around this? I tried the pattern in this picture i havent got it to work
No description

trpc useQuery/useMutation not inferring return type of prisma query

Env: Node18 , npm i'm using turborepo with the server as Honojs + hono-trpc adapter and the client as react vite So i've already did the setup as said in the docs and everything is working perfectly everything returned from the trpc procedures is inferred except when i return a prisma query then the inferred type is "any" ?? ...
Solution:
i solved it so it was an error with the context which contains (prisma and telegram bot) not being inferred from the client so i had to type it manually now all returned prisma queries works as expected...
No description

AWS Amplify & T3 stack env var issue

I’m small app with for now only auth and is not detecting env vars on amplify I created with next auth, tailwind and nothing else. On the logs I only see that the next auth and provider env vars are not detected with the message that they are required...

Does uploadthing have an automatic delete feature?

I wanted to know whether or not uploadthing can check how old the files are and delete it if its older than a certain period of time.

NextJS prefetch bad for bandwidth?

From what I understand nextjs links prefetch pages as soon as the link is visible on the viewport. Isn't this terrible for large apps, for example my job is building headless ecommerce sites and the products page could have almost a hundred links if you include the navigation bar, footer & products. Wouldn't this be prefetching a hundred pages & very bad for bandwidth? In ecommerce the majority of consumers are mobile visitors which means they could be on limited mobile data. I've tried to search for anything on bandwidth + prefetching on the docs but couldn't find anything. I've found some articles on how NextJS supposedly accounts for low bandwidth users but got no deeper detail how or when it does this....

UploadThingError at INTERNAL_DO_NOT_USE__fatalClientError

I get this errors on uplaoding - GET https://api.uploadthing.com/v6/serverCallback net::ERR_BLOCKED_BY_CLIENT - Something went wrong. Please contact UploadThing and provide the following cause: FetchError...

Uploading a File Via POST

I understand that most people use the client React components, but I am trying to upload a file on the server side by making a POST request to the main route, however, I noticed that it only accepts JSON and I was wondering if you were able to use form-data? I am testing this in Postman, but it doesn't seem to work.
No description

Code ownership

Does a company own my code if I they didn't hire me for programming, but I wrote some to simplify certain tasks? Just asking out of curiosity. I am not planning to publish/do anything with it....

Delete file using supabase

I would like to use supabase edge function to delete a file when a delete event happen, is there a documentation on how to set up connection to uplaodthings from this environment?

tRPC fetch breaking when building Next project

I'm testing out tRPC, and I've tried fetching some asynchronous data. This only happens during pnpm build, dev mode works completely fine. The fetch is prefetched in the page, and then actually fetched within the component. It always errors in this way when it gets to the static page generation step....
No description

Extending React Markdown with any component

Hi, I'm trying to implement charts into the markdown langauge. Currently, I'm using Mermaid for some basic charts but I want to implement my own. For example: ```markdown pie title Pets adopted by volunteers...

Building an npm package that has server actions

Hi i am building a small npm package and i want it to use server-actions a bit stuck for a couple of days and i just can't seem to find good examples, runing into tbh propper skill issues when it comes to building standalone packages. Would really apreciate help.

Session Callback Not Triggering in NextAuth Integration with tRPC

Hello everyone, I'm facing an issue where the NextAuth session callback is not being triggered when using credentials, causing undefined session data to be passed to tRPC context. The session callback works correctly with Google login. If anyone can provide insights or suggestions, I'd appreciate it. For more details, please check the GitHub discussion....

Building the facebook/react project

Hey folks, I realize this Discord probably isn't the appropriate place for getting support around this, but I'm curious if anyone knows someone or knows someone who knows someone that might be able to help out with this? I've noticed recently that the React contribution guides have been royally failing for me, particularly this build step with everything installed on Apple Silicon: Node LTS, JDK 22, yarn, gcc, etc. Using the build step:...

Seeking robust multi-tenant authentication for NextJS/Node app

We're developing a full-stack application using NextJS and Node (split backend), with Prisma as our ORM, tRPC for API calls, and other modern tools. We're looking to implement multi-tenancy in our app, but we want to ensure it's both secure and elegantly designed. Our main concerns are: 1. Finding a clean approach to implementation...

dotfiles

More and more I want to create my own dotfiles repo to ease sync between workstations, have a backup and share my settings if any co-worker or random people on internet ask. Any good resources, examples, do-and-do-not you can recommend? Of course I saw few other people dotfiles repos and it's interesting, but maybe something interested I missed; Some people even include their full system config, like those NixOS users - maybe I will join them one day when W10 goes out of support finally. BTW: Does Theo have his dotfiles public somewhere?...

MonkeyType

So im trying to make a type test webapp, and i was wondering how monkeytype (or any other typing site) verifies that the data sent from the client to the server is legit. For example monkeytype calculates statistics like words per minute all on the client (i think), and that data is then saved on the server. What is preventing anyone from fabricating post requests with fake data (such as a higher wpm) to then be processed on the server?
No description