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

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 = () => {...

T3 for a chat app

Although I don't remember the exact video now. I remember Theo saying that the t3 stack would not be optimal for an application that constantly updates it's data. I assumed this meant something like a chat app that relies heavily on web sockets. If I am correct here, could someone help me understand why using t3 app is not optimal for this type of app? Also what should I use instead?

How do I use a tRPC procedure outside a react component

Hello guys, I made a simple router which will give me similar tags from my tags model from prisma ```js import { z } from "zod"; ...

Syntax help for useQuery with no inputs

hi, i have two queries in my component, however on my first query I can't pass in refetchOnMount? any ideas? Thanks...

Alternative to Planetscale for multiple smaller apps

Hi While creating our latest tool, I used the tRPC + Planetscale + Clerk stack and fell in love with the Planetscale branching feature. Now the problem is their pricing. We're developing a few smaller, oftentimes internal apps/tools. We wondered if there's an alternative to Planetscale that doesn't charge as much per database. We'll never reach 100 billion row reads per month with our small apps. But having the database branching feature is still a way better workflow than classic migrations. ...

Removing unused imports

A rather annoying and controversial thing that was built into version 7.3.2. As far as I can see, this is disabled by default in the latest version. Maybe someone will tell you what was responsible for enabling it in older versions? Probably something connected with "prettier-plugin-organize-imports", but i'm not sure thinkies

variable initialized useState as true but the state is false

hasReaction is true, but liked is false error gets printed multiple times const hasReaction = postWithUser.reactions.some( (reaction) => reaction.userId === user?.id ?? ""...

create-t3-turbo monorepo: How to access user session to packages/db?

I would like to access some props from user's session to prisma middleware i.e. in below example: I would like to get contextLanguage from user's session (nextauth). adding @acme/auth as a dependency to @acme/db package, may create circular dependency? ...

Creating an update mutation with tRPC

Hi everyone, I'm trying to use an update mutation in this way: ```ts export const beerRouter = createTRPCRouter({ # other operations... updateQuantityById: publicProcedure...

Create and Download PDF

I have a web app that allows users to edit a table including drag/dropping rows, change row colors, edit text, etc... Once they are done editing it I want them to be able to export the table as PDF. However, I've tried some different PDF libraries and none of them have a straightforward way of taking your component including the Tailwind CSS styles and create a multi-page PDF. I also don't want to convert my component into an image using something like html2canvas to allow users to highlight text on the PDF. Here are the libraries I've tried: react-pdf...

Is it possible to pass a zod schema as a prop?

I have this ```ts interface Props { schema: ZodSchema; children: React.ReactNode;...
Solution:
owo7 if you want to accept any zod schema then you could do something like ``` import type { ZodSchema } from "zod" type ComponentProps<TSchema extends ZodSchema> = {...

Loading state of a `'use server'` component

Is it possible to have a loading state for e.g. a form submission using the new use server directive in nextjs 13.4? I only see using client components at this point when I'm looking at the docs. Am I missing somehting? 😂...

How do you self host your projects in a vps

without relying on any cpanel or vercel, i have a vps and i usually move the project using git and run yarn build then yarn start i also sat up a systemd service that handles keeping that website running ...

Geniune question: php vs server components

I love nextjs. I hear a lot of comments about nextjs just reinvented php. Can someone clarify things for me. How are they different? I know they are but can't list in bullet points. I would appreciate it if you can let me know.

How do you fetch an svg from s3 into an angular app?

I tried several things, but each time the svg isn't displayed.

What's this error

it was working till yesterday then i added stateDistrict to address model then i started to get this error. Which enumTypes are undefined?
Solution:
Go to vercel, remove the cache and redeploy

Prisma find many undefined

Hello, In my other projet when i do prisma.resource.findMany({select: ...}) the type is {id: string, createdAt: Date}[] but in a new project ( created just now with T3 ) when i do the same thing i got {id: string | undefined, createdAt: Date | undefined}[]...
Solution:
Hello, In my other projet when i do prisma.resource.findMany({select: ...}) the type is {id: string, createdAt: Date}[] but in a new project ( created just now with T3 ) when i do the same thing i got {id: string | undefined, createdAt: Date | undefined}[]...

ESLint to force @types in dev-dependencies

We recently had an outage coz someone installed the @types/[package-name] in dependencies, but never installed the actual package itself. Particularly, they installed @types/imurmurhash in dependencies, but didnt install imurmurhash itself (and no one reviewing noticed it in the PR). Our no-extraneous-dependencies rule in ESLint didnt catch this coz the type declarations were present. Had the @types/ been installed in dev-dependencies, ESLint would have caught the missing dependency issue. Anyway to use to ESLint to check @types / packages are dev-dependencies and not dependencies ? I can raise an issue in ESLint, but was wondering if getting a solution might be faster here....

Updating existing T3 with Supabase Auth from Next Auth

Background: - Launched a T3 app with Next Auth. - Currently got 3000 users. - Launching an app version (expo), so migrating T3 app to T3-turbo. - Upgrading Next-Auth to Supabase Auth to work with React Native, want to keep existing users and ease migration....