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

SPA or MPA for react native dev

Hi all, I am fairly new to React Native mobile development, and have cloned the turbo and clerk template. I was looking into using different screens or how to implement them, and I was wondering if I should be treating my app as Single Page App or Multi Page App? I’ve looked into the docs of React Navigation/native and it seems confusing if I need to pass the navigate property to every screen/component that needs to reroute the app and seems very weird not correct. Is there another library I could use or should I be treating it as a SPA and just change what is rendered based off the users selection?...

get variant list from CVA definition

Hey all I'm using class-variance-authority to define component styles. Wondering if there's a way to reuse the defined variant keys. E.g. ```tsx import * as React from "react" import { VariantProps, cva } from "class-variance-authority" ...

Issue with Next-Auth DefaultSession module augmentation

Hi there, barely made a new t3 project. I am getting an error probably related to the module augmentation for users id. Here is the error....

Client variables not typesafed

Hello, it seems I did everything right from the docs, but I still have client variables not typesafed. see example in .tsx file...

insert query in kysely, typerror

Hi, I try to migrate from prisma to kysely, only use Prisma for generating the types. Currently I have a insert into db like this with prisma api ```ts await ctx.prisma.voteAnime.create({ data: { votedAgainstId: input.votedAgainst, votedForId: input.votedFor,...

clerk cant check passwordless

so did clerks dashboard get a new update to the ui? bc in the tutorial theo could easily check passwordless but here it isnt an option

prefetchInfinite on getServerSideProps using SSG helpers

I'm trying to implement pagination using infiniteQuery and SSR with trpc: - ``` export const getServerSideProps = async () => { const ssg = generateSSGHelper();...

Typing Prisma Wrapper Function

```ts public async getUser( { provider, accountId }: Partial<{ provider: string; accountId: string }>, include?: Prisma.UserInclude ) {...

tRPC prefetching URL slower? - What am I doing wrong here.

I've been toying with ISR attempts, failing, so moved back and am going step by step. During testing, I tried (and by the loading page details of the JSON) succeeded! The pre-fetched data is there! However, the page is 30% slower in lighthouse! Am I doing this wrong? The goal is to eventually have it cached for SEO purposes, so pre-fetch of just the query isn't quiet there yet....

understanding <a> in nextjs

Hello I am a little confused about how links work in nextjs I am using the <a> tag. In the first image I use the <a> tag an get no errors but in the second image I get an error. ...

How do I represent relationships in a sql database?

I don't want to duplicate the connection twice, so I though there would be a way to do this in sql. I'm not good at sql, but I would assume that the logic of the query would be something like: select col!='7mida' where userA='7mida' or userB='7mida' from connections; ...

Persist Theme Value in Nextjs from ContextAPI

Hello. I'm trying to persist theme data in a Nextjs application (v 13.1.1 pages) using ContextApi. Now, usually the theme state gets compiled from a ThemeContext and passed into the application. When the user toggles the theme, I save this value in local storage for when they come to the site again. This fails because Nextjs is first generated on the server and there's no local storage. What I tried...

Next 13 API responses just froze after build

This logic is supposed to return the current date when the end point is requested, it works fine on dev mode, but this endpoint response is frozen/cached after i run build, can someone clarify what is happening? I'm even doing the best i can on headers response and in client to turn this page like a getServerSideProps page

how long should install be?

we've been stuck here for a couple min.

P1001 Error with Prisma trying to reach database server

I’m following Theo’s T3 tutorial but when trying to do ‘npx prisma db push’ I get an error saying P1001: Can’t reach database server at ‘aws.connect.psdb.cloud’:3306 I can’t figure out if it’s an issue with planet scale or prisma and couldn’t find anything helpful online. Thanks in advance for any help...

Simple long polling with tRPC

I'm sending an email with a useMutation with MailJet. MailJet's API returns success, even when the email is queued, sending may still fail. They have another API to get the status of the email. I've created a backend function with Quirrel to keep hitting that API until i have a status that's not pending, and then put that status in my DB. Now I want to long-poll my db in the useMutation's onSuccess to check the email status. In order to do that, i create a function in the onSuccess that invalidate's the whole collection's data every second until i get the status. I'd much rather just check the ID of the item with like a Get API repeated and then invalidate everything when it changes... is there a way to do that with tRPC? Also, This sounds overly complex....

ThreeJS with Create T3 app

Hello, I have seen this repository that combines nextjs with react three fiber: https://github.com/pmndrs/react-three-next...

Role bases authentication with Github Provider using next auth

I want to implement a role based authentication like admin, author and reader using next auth and providers like github, so far I've found doing the same using credentials, is it possible with providers like github etc?

better supabase auth than with useEffect & getSession on each page?

apparently the way i was doing this was very noob, but not sure what the best alternative would be before i had a useEffect on each page in my webapp like this ```ts...

Session Auth using Redis and next-session

Hey everyone, This is more of a resource than a question, but I wanted to share an elegant approach to session auth within NextJS (in my opinion).
Personally, I've not had a great time using Next-Auth since most projects I'm involved with use credential-based auth. I find Next-Auth is a bit too opinionated for my liking and requires a certain database structure. That, and I'm not too fond of JWTs. After doing some research, I stumbled across next-session, which allows you to create a custom session store. The next-session docs are clear and concise and helped me create a custom session store with Redis (using ioredis)....