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

My callback is failing for larger files

Hi! I'm working with PDFs and I'm doing some stress testing with bigger files. Behind the scenes I'm embedded and indexing the pdfs in an Upstash db, and originally that was the culprit due to the exceeded limit of the metadata text size, though that was quickly resolved....

Prisma Migrate Diff coming back when it shouldn't

Our team is using Prisma as our ORM, and have a Github Action that runs
npx prisma migrate diff --exit-code --from-schema-datasource ./prisma/schema.prisma --to-migrations ./prisma/migrations --shadow-database-url
npx prisma migrate diff --exit-code --from-schema-datasource ./prisma/schema.prisma --to-migrations ./prisma/migrations --shadow-database-url
...
No description

My NextAuth session callback fetches the database too often

So.. I have this web app built with nextjs, the auth is done with next-auth (authjs). I have a session callback in which I set a few user properties such as default_team_id, verified, and id. I am facing too many queries. More than 10k queries in a week of development. The session queries the database on every router refresh or navigation. ```ts...
No description

Tailwind classes aren't applying in dev and sometimes in production when login via credentials

Tailwind classes aren't applying in dev and sometimes in production when login via credentials, it acts normal when I close VS code and then start it again and do a napm run dev. Also for some weird reason Tailwind also stops applying when I log in via credentials (I am using Next Auth for a custom login page)...
No description

Favicon not showing on google

Hello guys ! I've got an issue with my favicon not showing on google search even tho i fixed every single issues i had on google search console, can anyone help me with that issue ? (Using next 14.2.1 and the ratio of the favicon is 48x48)...

TypeError: Cannot read properties of null (reading 'useContext')

Hey Guys, I'm experiencing an issue with my builds as of today. ```...

How to prevent multiple DB calls in this situation

I am using T3 stack with: - Drizzle - WorkOS AuthKit - Next JS app router ...
Solution:
in the lucia docs they recommends to use the cache function from react https://lucia-auth.com/guides/validate-session-cookies/nextjs-app...

db:push not asking if I want to rename or create a new table.

I'm doing the modern React stack tutorial and i'm currently stuck at adding userId to my Drizzle db. Same code but not sure why everytime I run db:push I never got asked if I want to "rename or create a new table". It always create a new table for every name changes. If I want to add the "userId" to the same table, it simply won't do anything. db:push doesnt return any error but the db and the schema on drizzle studio does not reflect the new schema with the userId. First time using Drizzle. Any help is appreciated!...

pnpm create t3-app@latest ERROR: No package.json found

Hello! Long time listener, first time caller. I've tried making a new T3 app using "pnpm create t3-app@latest" on my CLI and it's showing ERROR: No package.json found in "directory". What am I doing wrong? Also first time really using pnpm. I checked and believe I installed it correctly. Thank you for your time!...

what is the best sql cli client (NO SHITTY FORMATING PLZ)

looking for a cli lightweight alternative to sql developer, the cli sql session that comes default from dbs have shitty formatting

Managing Multiple Promises in Next.js

I'm working on a project where we display multiple reports on a single page. Each report has its own set of filters, and currently, I'm fetching data from the database separately for each component. However, when I change the filter in one component, the entire page re-renders, causing all components to refetch data. Since I'm fetching data on the server side, I can't use memoization to prevent rendering. How do you typically handle this situation to avoid unnecessary page renders when only one component's filter changes?...
Solution:
These are trade-offs. Server components are really great to have access to all your data without creating complex APIs with potentially huge JSON payloads. But if you want fine-grained control of how the UI updates then you're going back to what hooks, APIs, and state management are good for. And that's perfectly fine, albeit it might be more complexity than you hoped for. Load the initial page from the server. Then handle updates on the browser....

Next.js API Type Safety without tRPC?

I'm having issues with tRPC and am thinking of removing it from my project. Since I'm using App Router, it's less of a problem when calls are made on the server. However, I still need to make calls from client side. What are some good solutions for that?...

t3 workflow?

I'm in the dark on the t3 infrastructure and how it affects the development process, and I don't think it's meta enough for #ct3a-meta. I'm trying to add an email provider using Next-Auth. I've been making changes to its files (eg, ./node_modules/next-auth/providers/email.js), but they don't seem to make it to the app. The Next dev environment's HMR doesn't hot-reload packages like Next-Auth, correct? I have to restart the app for changes in them to take effect? No logging output shows up in the server output (terminal). Where should they appear, and what would prevent them?...

TypeScript Compiler API: Recursively resolve type

I am struggling to recursively resolve types with the TypeScript compiler API. Say I have for example an application containing the following type: ```ts import z from "zod"; export const schema = z.boolean(); ...

project idea suggestion?

Can anyone suggest me advance Image Processing project please. If u have done any can u share me the repo link...

UTApi (Server SDK) - getFileUrls with keyType equals "customId"

I'm using the ids of my products table as customId when saving the files, and I want to retrieve the urls using the id from my database, but the response returns an ```ts data: readonly { readonly key: string; readonly url: string;...

Weird Clerk behavior(user is null) with new API

So I started a new personal project with T3 yesterday. I added Clerk for auth, and it looks like they've upgraded their API so their are a lot of new primatives. I'm trying to just fetch the user in my API, and it's being weirdly difficult. I feel like I'm following the clerk docs to the letter, but as you can see in the terminal console log, all the properties on the user are null(I'm obviously logged in when sending this request). The request is being cached since it's not taking in any params, but when I do a hard refresh it still console.logs the null user so I don't think that has anything to do with it 😕
Middleware.ts...
No description

[TRPCClientError]: Converting circular structure to JSON

I'm getting this error only in production (Vercel). I'm using tRPC, Supabase, Clerk. The website crashes right after login. Browser error:
Application error: a server-side exception has occurred (see the server logs for more information).
Vercel logs: ```sh...
Solution:
idk what the issue was, but I recreated the setup and it works now

pnpm - ERR-INVALID-THIS

Recently tried to convert my plain t3 app, into using turbo repo. Now when i try get it to deploy to vercel it screams red at me. Anyone have any ideas?...
Solution:
I found the issue, i had my pnpm package lock from the original repo still in there. If you encounter this issue, remove all package locks. And reinstall packages. Then commit back to git....
No description

Have you tried mentorship

Hey everyone, I'm an in pass of becoming senior Web Developer but like every x-month I'm not feeling competent enough. Hi impostor syndrome 👋 . In order to compensate that I wanted to follow CS50, work a lot on my design pattern but as well probably going for a mentorship. My question would be : Have you ever used some? What is your take on it? Which website would you recommend?...