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

Getting ts-jest to work with testing files that use the .env mjs files

I'm trying to write a unit test to verify some code. This code uses the t3 env variable which is setup in these .mjs files. When I run jest it keeps failing to import from "./schema.mjs". Does anyone have an example repo which has test working fine in this scenario?

Make a button which downloads PDF

I know this is a noob question, but I haven't actually done this before. I have a nextjs web page. I want to make a button which downloads my resume as a pdf. How would I do this ?

Failed to load next.config.mjs

When I run my T3 App, It shows Failed to load next.config.mjs ```
frontend-new@0.1.0 dev next dev
...

Turborepo, Docker and multiple Nextjs Apps.

Hi guys, i need some help, i have a monorepo (turborepo) of nextjs proyects, and they have a lot of common dependencies like react, next, etc. So i'm trying to dockerize my monorepo, and trying to 1 only install common dependencies once and 2 trying to reduce the final image size of each service, i already try it nextjs standalone and fail 😦 . Anyone know how to fix this?

how can i useQuery() useMutation() in a useEffect

I have a response sensitive trpc(t3 stack) route With the current way t3 stack works this is a bad idea Because everything must be block scope i can wrap calls in useEffect to enable me determine when it should be triggered ...

create-t3-app and @next/font

Since @next/font is only available in next 13 is it advisable to update the 12.3.1 version of create-t3-app to latest or does it break anything? Are there any better alternatives to @next/font?

text editor

Where is the vod of Primeagen teaching Rust to Theo? I found the one were Theo teaches TS to Pg, but cant fin the other...

Working T3 project with websockets?

Does anyone have a project which where they successfully have used subscriptions. I'm find it quite difficult to implement.

Add permissions for `turbo dev...`

I am trying start a t3-turbo-and-clerk app and after pnpm i and pnpm dev I get this error: sh: /Users/daleblack/Library/CloudStorage/GoogleDrive-djblack@uci.edu/My Drive/dev/bible-mem/node_modules/.bin/turbo: Permission denied  ELIFECYCLE  Command failed with exit code 126. The app is located inside of a google drive folder which is streamed (not on harddrive), so I am guessing that's the issue. Any ideas how to solve this?...

Remove - Upload - Update

Hello all, I have a question regarding the correct flow to follow when doing these steps, the goal is this, a user can only have a profile picture, so first we check if that profile has a picture if it does delete it and then we upload the new one, then I try to fetch the new one that has been upload it, right now however this is not working as expected as I don't get the correct updatedDate url, perhaps I am missing something? after these steps are completed i use prisma to update the db and th...

Relations between Clerk Users with Prisma db

I've been using T3 for a few months now with nextAuth... I'm attempting to use Clerk with "t3-turbo-and-clerk". The part I'm getting real tripped up on is making relations between my prisma db and Clerk Users. With create-t3 / nextAuth, that nextAuth User table is in my schema and making relations is pretty brainless, but with Clerk hosting the Users, I'm not quite sure how to make that relation. Felt like a silly question to ask, but hopefully makes sense and someone can point me in the right direction! Thanks!...

Best practice for Admin dashboard?

I want to make an admin special page, but on the client side, I didn't know how to check if the user is admin, how can I do it? Should I check if the id from ctx is admin with getServerSideProps or should I check with trpc query? I want to do something like layout

Pass different objects into same prop - TS error

Is it allowed to pass objects of different structure into the same prop, conditionally? Something like this `...

NextJS SSR on nested routes

hi i have this case/page where i need SSR for opengraph metatags which is dynamic for each page let say i have routes /[profileName] and /[profileName]/achievement im hitting getProfile in SSR block inside [profileName].tsx, ...

Expo-Camera Bug Affecting Android only

Hey everyone, i'm having an issue with expo-camera with android only. Can anyone help with the distortion at the bottom and top of the photo. Everything works on IOS as expected. ...

Run trpc query...on first render only!

I have been wasting hours and HOURS trying to figure out how to call a trpc query on the first render only. I am querying data that populates a drop down select input. When an option is selected, my state updates and the component re-renders which calls the data again. I don't want to call the data again. ...

How to check if user has enabled JS on page?

In NextJs / React how can I check if the user has enabled JS and display some kind of message or maybe even hide the whole site until it's enabled? I tried ``` <noscript>You need to enabled JavaScript to use this site.</noscript>...

With pnpm (create-t3-turbo), packages are installed on the wrong project folder

As I'm building out my app in a monorepo using create-t3-turbo, sometimes packages I install are installed on the project-specific node_modules vs the root node_modules. Some packages might only be used in that one project, so I get that, but now even @tanstack/react-query and others are being installed in both the root and the project folders. Questions:...

Any good suggestions for storing user images, for supporting max 10k images for the whole website.

I am not expecting around 1000, to be optimistic it might go till 10k. Is it a good idea to store them in firebase cloud store, can anyone who worked on any user uploaded pictures( mostly products of e-commerce store ), share insights or potential problems,

trying to add role based authentication

I added a role parameter to my User schema, but it's still not catching it. Any one know why this may be?