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

Caching blog-like pages

We’re building a site with next.js and Strapi for the CMS, hosting on Vercel. Expect somewhere from 50-100k unique monthly users and wanted to know how to add caching to the blog-like pages. Using getServerSideProps for API calls to strapi to get the data required to generate the page. Any pointers for what to do / where to read?

runtime error when using getServerSideProps

HI guys, i got this project where im gonna protect using getServerSideprops and next auth, so users cant access admin page, i made the function that can be called inside gssp.

Vercel loading production env variables in preview deployments

I'm deploying my project to Vercel and I'm having problems because even on Preview deployments the production environment variables are being loaded. I have two databases and Firebase apps, one for production and one for dev, but it's always loading the production configs. When printing process.env.NODE_ENV, the value is production in both Preview and Production deployments....

NextJS 13 component chunk streams + Vercel

Hi, I'm trying out the new Next 13 app directory with streaming functionality, and try to progressively load my UI with suspsense I try to show one Feed component that has a delay of 2 seconds and another that has 5 second delay, both showing a fallback UI with suspense. All works as intended on the localhost Next development server, but once deployed on Vercel, both Feed components only show their result when the last one has finished their delay. They suspense together instead of independent. Feed component: https://pastebin.com/Ky37XGLM...

S3 File Upload

Anyone got an idea what I am missing here: And this is my api route: ```ts import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3"; import { randomUUID } from 'crypto';...

NextJs Image component

Hello , I want to deploy my nextjs app to AWS using docker and kubernetes, How can I make the next/image component optimisation work ? Will it work if I use sharp library ??

object might be undefined, but have a undefined check

Here is my code, and im getting a "Object is possibly 'undefined'.ts(2532)" error. messagesWithCoach.data is a json object with the key being a coachId (String), and the value a list of objects Why am i still getting this error even though im checking if its undefined...

Making sure a dependabot PR doesn't break my project?

Hey ya'll. how can i make sure a dependabot PR doesn't break my project? i'm assuming that upgrading minor versions shouldn't cause too many issues, but i just want to be safe.

T3 stack + r2?

I'm currently building a project where i need to store pdf file. the uploadthing only support image and video for now(correct me if im wrong), also the vercel blob is too expensive and also beta. however, blob is wrap around the cloudflare r2 so i figure that maybe i can connect directly to r2. but i have no idea how to, there no video on yt or doc to follow.

React Native - Offline Database for t3 stack ?

I currently have production app that has been running on supabase for sometime now, and want to make it offine first with sync. Looking at rewriting the app using t3 stack as there is going to be web version. I want to still keep the supabase db , but only to sync for the web version . Any thoughts on that and any recommendations for a good database for RN (expo)

Many queries when switching tabs

Whats the default behaviour of prisma and trpc when you click to a different tab and back. I'm getting lots of queries everytime i do this. Wondering if it's something to do with the dev server setup or if I might have something else going on.

infer parameter type from external type

Hey I am having a really hard time writing some library types. (I don't have experience with types in libraries) Maybe I am missing something: so I have a function with a generic parameter i use to infer the type of an attribute of the paramter which is an object. I want to refactor the object parameter from beeing an inline type to a reusable type outside. Long story short I am pretty much stuck 😅 ...

Clerk profile

Hello, sorry if this is a dumb question but I don't know Clerk very well and I would like to understand how it works. Is it useful to have a Profile table if we want more information for the user (for example his shoe size)? And should we use the userId in our database as if we had a user table and then call getUser from the clerk client? Thanks...

How should I handle permissions for restricted pages?

E.g. Admin / Manager access pages with Read Update Create Delete specific permissions?

Error when using getServerSideProps

HI guys, i got this project where im gonna protect using getServerSideprops and next auth, so users cant access admin page, i made the function that can be called inside gssp, this happen when i refersh the page

Question Abut vercel

if i sign up for vercel using github will it have access to every private and public repo i own? what if i just sign up using email. is it hard to setup git hub accoount or is it the same thing i just want vercel to have access to only one of my repo...

Zod conditional required/optional validation

I am using React Hook Form and Zod. I want make some fields optional/required based on other inputs. Here's an example: ```js const schema = z.object({...
Solution:
if you have a more then two options this solution will be nicer ```ts const enumToField = { video: "videoFile",...

Is it currently possible to use clerk auth with NextJS' 13.4 server actions?

I know it's currently in alpha, but I'd like to know if there is any way to use it right now. Library versions are the latest. ```log...

Testing on project with @t3-oss/env using vitest

When I try to write unitest on brand new create-t3-app ("initVersion": "7.13.0") with vitest installed. ```typescript // src/utils/testedfn.ts import { env } from "@/env.mjs" export const getmyenv = () => {...