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

Deploy Strategy

What do you guys use for your deployment strategy? I bought a virtual private server and I'm trying to figure out the best way to deploy.. I'm leaning towards docker and GitHub actions with nginx

TRPC UseQuery

How can I have a trpc useQuery hook only be called if there is an active logged in session? I understand that you can't use hooks inside conditional statements, and that's why I'm getting the following error. Unhandled Runtime Error Error: Rendered more hooks than during the previous render. Image...

403 Protected TRPC | Vercel Deployment

Hi, i've been running into an odd issue using protected routes with CT3. It seems when I deploy my CT3 app to vercel, all my protected routes throw 403 errors even though i'm authenticated. I'm unsure why this is, and haven't been able to find a solution.

Will next-auth fetch the account information from API every-time I page refreshes or changes?

Or maybe useSession or getServerSession call? If it does how can I prevent this, because I am using discord provider and even with a 1/2 users using the website its getting 429 Ratelimited very often. Code of my auth.ts...

Typescript question

I have code like this but I think my types are wrong because I cant access shape of zod schema on my class, also on comments I have some questions, any idea? I would like to be able to get schema on my database class correctly: ```ts import z, { type Schema } from "zod"; export class Database<T> {...

Getting a possibly undefined after undefined check

Getting really bugged with typescript here - what is going on here? The warning is that the object might possibly be undefined...

Prisma model name preferences

Hello, What do you guys prefer or what is the "right" thing to do? ```prisma...

Is there a good sqlite client for js?

I'm really trying to cope with this one: https://www.npmjs.com/package/sqlite3 but seems like it has been designed to hate you....

Zod File Upload Validation with Open-Api Support?

Hi guys, anyone know how to validate file upload with zod and get also open-api support?

Zod File Upload Validation with Open-Api Support?

Hi guys, anyone know how to validate file upload with zod and get also open-api support?

Zod validation and open-api support for Express.Multer.File or any File type on the server?

Hi guys, anyone know how to validate a File upload using zod? and also have open-api support?

Caching Data for a trpc endpoint

I need to hit an external API every few minutes to update my local data Call this BigDataList ...

React Query - Slow performance with many small cached requests

I have a list of accordions. Every accordion have items that contain image. On accordion click, I fetch items text data and image id to speed up list loading and load images later. Inside an item, I use image id to fetch an image per item. Image is in base64 format. In every accordion, I can have 10 or more items, so in total there can be few hundreds. ...

Can you run a NextJS project on a closed network?

I would like to run a NextJS project in a closed network that doesn't have access to the internet. Assuming i have all the dependencies already installed, can i just run the project, will it work?

Weird min-width: max-content behavior (jsfiddle)

Can someone explain to me what's happening in this fiddle? https://jsfiddle.net/th147dmf/53/ This is a simplified version of something that is happening in my actual app. If you comment out the width: 1px the overflow behavior is ruined, even though the 1px width doesn't seem to be used....

Discord/Slack page embeds not working

Hello - I am trying to add some meta tags to my Next page so that the metadata is collected by Discord when I link my website. I'm following the instructions from here: https://stackoverflow.com/questions/54266598/meta-tags-for-url-with-description-and-image-in-skype-discord, and have added the tags to a Head component in the image below (hardcoded to test functionality). These tags are visible when inspecting the elements on the production site (in my browser at https://playbook-sand.vercel.app/play/cleihuzk30005cxcizs743oim), but for some reason they're not appearing as a Discord embed. I do not believe caching is the issue as I've tried adding random strings to my URL to force a refresh from Discord. Does anyone know if Next automatically hides these tags from scrapers or something? I'm a bit lost on how to fix this and hoping someone here has had a similar issue....

Promise-returning function provided to attribute where a void return was expected.

Hello, doing app with t3. I am using react-hook-form and I am getting error from handleSubmit: Promise-returning function provided to attribute where a void return was expected.eslint@typescript-eslint/no-misused-promises ```ts...

Prefetching more items than requested on client side

Hey guys, I was wondering about prefetching a long list of items (100) with getServerSideProps, but then - user will request just 10 of them on every page. Is that actually going to work and take 10 items of prefetched 100 every time?...

How can I cache blob image provided by backend (React)?

I have a list of accordions. Every accordion have items that have images. On accordion click, I fetch items text data and image id to speed up list loading and load images later. Inside item I use image id to fetch image per item. I get a blob which I convert to URL with URL.createObjectURL(blob) I use react query, so I can cache and stale request response. However, even if the request is cached, the image doesn't load instantly after closing and opening accordion, probably because it creates new image URL from blob....