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

[next-auth + google] can't login on production

[next-auth, next 12, google provider, vercel] Logging-in works in dev, but no in production. When I choose an email on the google widget, it redirects me to the login page. There is no error to be seen, all network requests have 200 status,...

Does somebody know Rust and JAVA?

What code is more readable? Java or Rust?

Server Actions: Do you need to validate the session when calling Server Actions?

1) When using server actions, there's no need to use csrf tokens anymore right since no external party can call your server action. So it saves this whole step and complication right? 2) When using server actions, if I am storing my sessions in a database, do I still need to check if the user has an active session on every server action mutation? In the past you would need to since anyone can POST to your route. But now with server actions.... only you can call a function on your server right? Therefore, there's no need to validate any database changing function calls in the server action right? Or is that wrong, because someone can manipulate the javascript on the client side to still call the server action?...

uploadthing error

I'm using the DANGEROUS__uploadFiles function and keep getting this error. I don't think I have done anything wrong, is this function deprecated?
No description

pnpm install fails with code 128

Trying to switch from yarn to pnpm. I've installed latest pnpm, I'm on node v18. I've never seen this error before
No description

Supabase Auth vs Clerk

Hi, what's the biggest difference between Clerk and Supabase Auth? Supabase is free for 50k MAU, Clerk is a whopping 10 times less, just curious as to why

How to call mutate only once on page visit? (For Change Email Confirmation Links)

I'm struggling to get a mutation to fire exactly once in my application. Here's the scenario: when a user decides to reset their email, a token with a random UUID is generated and stored in our database. The new email then receives a confirmation link like base-url.com/email-reset?token={token_uuid}. The user clicks the link and lands on a page that shows a modal, which varies based on whether it's loading, successful, or encounters an error. My goal is to trigger the resetEmail mutation only once, as soon as the token from the URL becomes available. However, I've noticed that the mutation often gets triggered multiple times. This is an issue because the first successful mutation deletes the token from the backend, causing any subsequent mutations to fail and display the error modal although the email change is successful. Here's a code snippet for context:...

Filtering and search in RSC

I'm trying to implement filtering and searching in server components but its kinda slow, the way im doing it is i redirect to a new url with searchParams and then filter the data in the page.tsx which is a server component, Here's the code: thats from the child client component ```...

Is there a way to create a custom object when selecting?

Like in Entity Framework, we do something like this for example. ``` dbContext.Todos.Where(x => x.Id == id).Select(x => new { id = x.Id,...

Take-home assignment

I have a take-home assignment in which i need to implement a multi-column (not separate lists) drag and drop component in React without using any libs. Using html drag and drop apis was easy, but it didn't look exactly like this (video below). Then i used mouse events, and could only make it work (https://react-dnd-harshcut.vercel.app/) with single column. Does anyone one have any suggestions on how to proceed for two-column layout? My next thought would be calculating the position of the cursor on left or right side of the container and shifting the list items in it....

Next 13 App folder question

Hi, so I would need to open links and go to #sections on my app. Can I make these #sections work somehow when being on a different subfolder? So for example in /orders I would want to go to /shop#faq in the shared Navbar which is rendered in the shared root layout. Now can I delete my root page and make the /shop the default, in other words redirect to it once a user goes to / ? Any suggestion would be appreciated. This is the app I am working on https://github.com/GeroWalther/moonlamp-onlineshop...

SSR with tRPC (9.x) works for one query but not the other even though they're practically identical

I've got a component where I have two querys, one is usually faster than the other but I want to run both for side effects on the server. I use them like this: ```Typescript const Gallery = () => { const { data: fastImages, refetch: fastRefetch, isLoading, isFetching } = trpc.useQuery( ["gallery.getAllS3ThumbnailsFast", { categoryName: "Gallery" }],...

ShadCn Styling / Functionality Issue

Hey all, this is a slightly unusual use case, but I've been asked to implement it, I have a list of items in a Select box, which I want to display a tooltip for each one explaining what that item is. I've tried so many combinations but can't seem to get it working, help would be much appreciated 🙂

tRPC: Why useQuery() tries to refetch when error occurs while useMutation() doesn't?

I'm using the T3 stack.
test: publicProcedure.input(z.string().min(5)).query(async () => {
return "hi!";
}),
test: publicProcedure.input(z.string().min(5)).query(async () => {
return "hi!";
}),
...

Prisma migration issue on vercel deployment

Hi Gang, I'm facing a persistent migration issue with my prisma model in my PostgreSQL database hosted on Railway. Here's a breakdown of the situation: My original prisma schema model was the following: ...

Struggling with CSP nonce

Hi! I'm struggling to implement a nonce based content security policy on my app. What is the recommended way of doing it in T3? The only solution so far that I could find in the next docs is to use the app router where the x-nonce header will be automatically read and attached to every script or style tag but it just doesn't do it on page router and the whole app bundle gets blocked....

Struggling with PNPM Workspaces - How to Link Local Packages

👋 Hello Devs, I'm currently working on a TypeScript package called zod-to-fields that I wish to test with multiple frontend frameworks (React, Vue, Svelte). I'm using PNPM and have set up a workspace, but I'm having trouble figuring out how to make it all work smoothly. 📂 Folder Structure...

T3 env in nextjs custom typescript server

Hello, Im trying to setup Nextjs 13 app router with custom server with typescript. So far so good I was able to get the latest tRPC setup with nextjs13 app router and custom express server entry point all in typescript. But I would Like to use T3Env in that custom express server entry point but Im failing to do so. Complaining about the esm module inported in that cusotm server file. This is insane how much you need to fiddle to get something like that working in 2023 😄 anyway... I've followed this repo from vercel to get express server entry point working but dunno how to reconfigure it so I could use env.mjs Version I've used for T3 Stack https://discord.com/channels/966627436387266600/988912020558602331/1150912514322870322 Ts custom server example from vercel https://github.com/vercel/next.js/tree/canary/examples/custom-server ...

updates to tailwind.config.ts not applying?

I have updated my tailwind.config.ts to set new theme colors all colors in the app used this definition for theme colors Unfortunately despite recloning the repo multiple times, nuking node modules, rebooting my pc. Everything I can think of for any sort of cached results, the colors are not updating... I have no manually specficied any colors in the app, everything is stuff like...

Property 'res' does not exist on type ctx

I was following along Josh's tutorial(attached below; he writes the code at the 10:10 min mark) and I faced a small problem here where it says (Property 'res' does not exist on type '{ db: PrismaClient<PrismaClientOptions, never, DefaultArgs>; }') I attached a pic of my code and how josh's code look. How can I access these parameters and change them??? github repo for the project: https://github.com/ProfMoriartey/usta-sushi Josh's video: https://www.youtube.com/watch?v=ljsxNQ-nPog&t=886s...
No description